]> git.proxmox.com Git - pve-common.git/commitdiff
getopt_usage: always remove $standard_output_options
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 27 Jul 2018 05:23:39 +0000 (07:23 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 27 Jul 2018 05:48:44 +0000 (07:48 +0200)
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

index e395b95d5c6ea02a1f63b8c50e96440d71191755..ed7686324ec4f9127fd852fa95330d346aaedcde 100644 (file)
@@ -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 = {};
     my $out = '';
 
     my $arg_hash = {};