From 5c59d8f99c1ba2d02bbf8a123131dc791fbf1e27 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 27 Jul 2018 07:23:39 +0200 Subject: [PATCH] getopt_usage: always remove $standard_output_options Tools like pvesh and pveclient pass them as normal arguments. We use a simply heuristic to test if there is an 'output_format' parameter. If so, we remove all $standard_output_options and display [FORMAT_OPTIONS] instead. --- src/PVE/RESTHandler.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/PVE/RESTHandler.pm b/src/PVE/RESTHandler.pm index e395b95..ed76863 100644 --- a/src/PVE/RESTHandler.pm +++ b/src/PVE/RESTHandler.pm @@ -624,6 +624,16 @@ sub getopt_usage { } } + # also remove $standard_output_options from $prop (pvesh, pveclient) + if ($prop->{'output-format'}) { + $has_output_format_option = 1; + foreach my $key (keys %$prop) { + if ($standard_output_options->{$key}) { + delete $prop->{$key}; + } + } + } + my $out = ''; my $arg_hash = {}; -- 2.39.2