X-Git-Url: https://git.proxmox.com/?p=pve-client.git;a=blobdiff_plain;f=pveclient;h=2995fd5441e732bcf451828d7dca6f3b2cbde816;hp=34e2aab8b1b14028e534bc0024cf8420ad529fa1;hb=969b8624f35127abbf0002412932a247bfec4707;hpb=42de9764b4136b003c7d2cb80e709adb7c4c22a4 diff --git a/pveclient b/pveclient index 34e2aab..2995fd5 100755 --- a/pveclient +++ b/pveclient @@ -36,8 +36,8 @@ sub call_api_method { my $config = PVE::APIClient::Config->load(); - # test if api path exists - my $info = PVE::APIClient::Helpers::lookup_api_method($path, $method); + my $uri_param = {}; + my $info = PVE::APIClient::Helpers::find_method_info($path, $method, $uri_param); my $conn = PVE::APIClient::Config->remote_conn($config, $remote); @@ -51,7 +51,7 @@ sub call_api_method { use base qw(PVE::APIClient::CLIHandler); sub read_password { - return PVE::APIClient::PTY::read_password("Remote password: ") + return PVE::APIClient::PTY::read_password("Remote password: ") } @@ -84,8 +84,12 @@ my $path_returns = { type => 'null' }; # dynamically update schema definition for direct API call # like: pveclient api -if (my $info = PVE::APIClient::Helpers::extract_path_info()) { - $path_properties = $info->{parameters}->{properties}; +my $uri_param = {}; +if (my $info = PVE::APIClient::Helpers::extract_path_info($uri_param)) { + foreach my $key (keys %{$info->{parameters}->{properties}}) { + next if defined($uri_param->{$key}); + $path_properties->{$key} = $info->{parameters}->{properties}->{$key}; + } $path_returns = $info->{returns}; } @@ -111,7 +115,7 @@ __PACKAGE__->register_method ({ name => 'pveclient_get', path => 'pveclient_get', method => 'GET', - description => "call API GET on .", + description => "Call API GET on .", parameters => { additionalProperties => 0, properties => $path_properties, @@ -127,7 +131,7 @@ __PACKAGE__->register_method ({ name => 'pveclient_set', path => 'pveclient_set', method => 'PUT', - description => "call API PUT on .", + description => "Call API PUT on .", parameters => { additionalProperties => 0, properties => $path_properties, @@ -143,7 +147,7 @@ __PACKAGE__->register_method ({ name => 'pveclient_create', path => 'pveclient_create', method => 'PUSH', - description => "call API PUSH on .", + description => "Call API PUSH on .", parameters => { additionalProperties => 0, properties => $path_properties, @@ -159,7 +163,7 @@ __PACKAGE__->register_method ({ name => 'pveclient_delete', path => 'pveclient_delete', method => 'DELETE', - description => "call API DELETE on .", + description => "Call API DELETE on .", parameters => { additionalProperties => 0, properties => $path_properties, @@ -194,4 +198,11 @@ our $cmddef = { }; +if ($cmd && $cmd eq 'printsynopsis') { + + print __PACKAGE__->generate_asciidoc_synopsis(); + + exit(0); +} + __PACKAGE__->run_cli_handler();