From 936c07ece1ca26ffd5b762191cd0a97e3fd8815e Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 4 Jul 2018 10:11:30 +0200 Subject: [PATCH] PVE/APIClient/Helpers.pm - new helper print_result() --- PVE/APIClient/Helpers.pm | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/PVE/APIClient/Helpers.pm b/PVE/APIClient/Helpers.pm index 1503ec0..9ad0603 100644 --- a/PVE/APIClient/Helpers.pm +++ b/PVE/APIClient/Helpers.pm @@ -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; -- 2.39.2