PVE/APIClient/Helpers.pm - new helper print_result()
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 4 Jul 2018 08:11:30 +0000 (10:11 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 4 Jul 2018 08:11:30 +0000 (10:11 +0200)
PVE/APIClient/Helpers.pm

index 1503ec0..9ad0603 100644 (file)
@@ -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;