]> git.proxmox.com Git - pve-client.git/blobdiff - pveclient
improve usage text
[pve-client.git] / pveclient
index 8ea109d042ed7683a59681f85babad86f34a2e7d..165505fe45f33b485c5029d955234890827ec93e 100755 (executable)
--- a/pveclient
+++ b/pveclient
@@ -3,8 +3,10 @@
 use strict;
 use warnings;
 use lib '/usr/share/pve-client';
+use lib '.';
 use Data::Dumper;
 
+use PVE::JSONSchema;
 use PVE::CLIHandler;
 
 use PVE::APIClient::LWP;
@@ -15,8 +17,14 @@ use JSON;
 
 sub print_usage {
 
-    die "Usage: implement me";
-    exit(-1);
+    my $text = "pveclient usage:\n\n";
+
+    $text .= "pveclient remote <help|add|remove> {options}\n\n";
+
+    $text .= "pveclient <get/set/create/delete> <path> {options}\n\n";
+
+    print STDERR $text;
+
 }
 
 sub call_method {
@@ -25,7 +33,7 @@ sub call_method {
     die "missing API path\n" if !defined($path);
 
     my $info = PVE::APIClient::Helpers::lookup_api_method($path, $method);
-    my $param = PVE::APIClient::Helpers::get_options($info->{parameters}, $args);
+    my $param = PVE::JSONSchema::get_options($info->{parameters}, $args);
     print Dumper($param);
 
     die "implement me";
@@ -49,7 +57,7 @@ sub call_method {
 #my $res = $conn->get("/", {});
 #print to_json($res, { pretty => 1, canonical => 1});
 
-my $cmd = shift || print_usage();
+my $cmd = shift || (print_usage() && exit(-1));
 
 if ($cmd eq 'get') {
     my $method = 'GET';