mirror of
https://git.proxmox.com/git/pve-client
synced 2025-10-04 22:20:14 +00:00
complete_api_path: minimize completions
This commit is contained in:
parent
6b66e46c72
commit
a00bef992d
@ -203,21 +203,20 @@ sub complete_api_path {
|
||||
if (my $children = $info->{children}) {
|
||||
foreach my $c (@$children) {
|
||||
my $ctext = $c->{text};
|
||||
push @$res, "${prefix}$ctext" if $ctext =~ m/^\Q$rest/;
|
||||
if ($ctext =~ m/^\{(\S+)\}$/) {
|
||||
push @$res, "$prefix$ctext";
|
||||
push @$res, "$prefix$ctext/";
|
||||
if (length($rest)) {
|
||||
if (length($rest) && $rest ne $ctext) {
|
||||
push @$res, "$prefix$rest";
|
||||
push @$res, "$prefix$rest/";
|
||||
}
|
||||
} elsif ($ctext =~ m/^\Q$rest/) {
|
||||
push @$res, "$prefix$ctext";
|
||||
push @$res, "$prefix$ctext/" if $c->{children};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scalar(@$res) == 1) {
|
||||
$res = [$res->[0], "$res->[0]/"];
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user