]> git.proxmox.com Git - pve-client.git/blobdiff - PVE/APIClient/Helpers.pm
implement pveclient api usage <path>
[pve-client.git] / PVE / APIClient / Helpers.pm
index 1503ec0c90428ee08ec63e4cb2e8005b2faaae1c..9d599d6cd27b0b3f83d0ca688468aa9e8733f430 100644 (file)
@@ -20,7 +20,7 @@ my $pve_api_definition;
 
 my $pve_api_definition_fn = "/usr/share/pve-client/pve-api-definition.dat";
 
-my $method_map = {
+our $method_map = {
     create => 'POST',
     set => 'PUT',
     get => 'GET',
@@ -405,16 +405,23 @@ sub extract_even_elements {
     return [ grep { ($ind++ % 2) == 0 } @$list ];
 }
 
+sub print_result {
+    my ($data, $result_schema, $param_order) = @_;
+
+    my $options = {};
+    PVE::APIClient::CLIFormatter::query_terminal_options($options);
+
+    my $format = get_output_format();
+    PVE::APIClient::CLIFormatter::print_api_result(
+       $format, $data, $result_schema, $param_order, $options);
+}
+
 sub print_ordered_result {
     my ($property_list, $data, $result_schema) = @_;
 
-    my $format = get_output_format();
     my $param_order = extract_even_elements($property_list);
 
-    my $options = {};
-    PVE::APIClient::CLIFormatter::query_terminal_options($options);
-
-    PVE::APIClient::CLIFormatter::print_api_result($format, $data, $result_schema, $param_order, $options);
+    print_result($data, $result_schema, $param_order);
 }
 
 1;