Fix/instance prefix completion #20

Merged
Sebi merged 2 commits from fix/instance-prefix-completion into main 2026-10-28 10:46:36 +00:00
2 changed files with 7 additions and 6 deletions
Showing only changes of commit 6243514def - Show all commits

No files matched your search

+1 -1
View File
@@ -200,7 +200,7 @@ _netssh
t.Fatalf("%v\n%s", err, out)
}
// Directive 36 = NoFileComp|KeepOrder: unsorted host group, no file fallback.
want := "describe cache:Manage the cache\ncompadd -V hosts -X %Bhosts%b -- web01 web:02\n"
want := "describe cache:Manage the cache\ncompadd -V hosts -X %Bhosts%b -M l:|=* -- web01 web:02\n"
if string(out) != want {
t.Fatalf("got:\n%s\nwant:\n%s", out, want)
}
+6 -5
View File
@@ -58,12 +58,13 @@ _netssh() {
_describe -t commands 'netssh command' items $nospace && ret=0
fi
if (( $#plain )); then
# netssh already filtered the hosts, also by the name after an instance
# prefix: "fsn1" offers "prod/fsn1-…". 'l:|=*' lets zsh accept text
# before the typed word instead of discarding these matches.
local -a group=(-J hosts)
# Directive 32: keep the order supplied by netssh.
if (( directive & 32 )); then
compadd -V hosts -X '%Bhosts%b' $nospace -- $plain && ret=0
else
compadd -J hosts -X '%Bhosts%b' $nospace -- $plain && ret=0
fi
(( directive & 32 )) && group=(-V hosts)
compadd $group -X '%Bhosts%b' -M 'l:|=*' $nospace -- $plain && ret=0
fi
# Directive 4: no file completion as a fallback.
if (( ! $#lines && ! (directive & 4) )); then