X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=blobdiff_plain;f=src%2FPVE%2FJSONSchema.pm;h=32d461cbf6467e6ad7adbdd86b650df79e7f7228;hp=c925ecbad664164e4670d51e2a5002fa48d0725e;hb=43479146338948434f0b08ef854c96281ee0f268;hpb=5851be88ad2a1187c949045541b37c442cc18221 diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm index c925ecb..32d461c 100644 --- a/src/PVE/JSONSchema.pm +++ b/src/PVE/JSONSchema.pm @@ -817,6 +817,11 @@ my $default_schema_noref = { optional => 1, description => "This indicates the default for the instance property." }, + completion => { + type => 'coderef', + description => "Bash completion function. This function should return a list of possible values.", + optional => 1, + }, disallow => { type => "object", optional => 1, @@ -1077,6 +1082,8 @@ sub get_options { } } + Getopt::Long::Configure('prefix_pattern=(--|-)'); + my $opts = {}; raise("unable to parse option\n", code => HTTP_BAD_REQUEST) if !Getopt::Long::GetOptionsFromArray($args, $opts, @getopt); @@ -1132,7 +1139,7 @@ sub get_options { if ($pd->{format} =~ m/-list/) { # allow --vmid 100 --vmid 101 and --vmid 100,101 # allow --dow mon --dow fri and --dow mon,fri - $opts->{$p} = join(",", @{$opts->{$p}}); + $opts->{$p} = join(",", @{$opts->{$p}}) if ref($opts->{$p}) eq 'ARRAY'; } elsif ($pd->{format} =~ m/-alist/) { # we encode array as \0 separated strings # Note: CGI.pm also use this encoding