Skip to content

Commit a00ee19

Browse files
committed
fix: use _comp_compgen_split while keeping filtering by $cur
1 parent 158b8ba commit a00ee19

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

completions/slapt-get

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,17 @@ _comp_cmd_slapt_get()
6060
# slapt-get will fail to search for "^name-version"
6161
# it can search for names only
6262
local name=${cur%%-*}
63-
COMPREPLY=($(LC_ALL=C "$1" -c "$config" --search "^$name" \
64-
2>/dev/null | LC_ALL=C command sed -ne "/^$cur/{s/ .*$//;p;}"))
63+
_comp_compgen_split -l -- "$(
64+
LC_ALL=C "$1" -c "$config" --search "^$name" 2>/dev/null |
65+
LC_ALL=C command sed -ne "/^$cur/{s/ .*$//;p;}"
66+
)"
6567
return
6668
;;
6769
avl) # --install|-i|
68-
COMPREPLY=($(LC_ALL=C "$1" -c "$config" --available \
69-
2>/dev/null | LC_ALL=C command sed -ne "/^$cur/{s/ .*$//;p;}"))
70+
_comp_compgen_split -l -- "$(
71+
LC_ALL=C "$1" -c "$config" --available 2>/dev/null |
72+
LC_ALL=C command sed -ne "/^$cur/{s/ .*$//;p;}"
73+
)"
7074
return
7175
;;
7276
ins) # --remove|--filelist

completions/slapt-src

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,17 @@ _comp_cmd_slapt_src()
5656

5757
if [[ $cur == *:* ]]; then
5858
local name=${cur%:*}
59-
COMPREPLY=($(LC_ALL=C "$1" --config "$config" --search "^$name" \
60-
2>/dev/null | LC_ALL=C command sed -ne \
61-
"/^$cur/{s/^$name:\([^ ]*\) .*$/\1/;p;}"))
59+
_comp_compgen_split -l -- "$(
60+
LC_ALL=C
61+
"$1" --config "$config" --search "^$name" 2>/dev/null |
62+
command sed -ne "/^$cur/{s/^$name:\([^ ]*\) .*$/\1/;p;}"
63+
)"
6264
else
63-
COMPREPLY=($(LC_ALL=C "$1" --config "$config" --search "^$cur" \
64-
2>/dev/null | LC_ALL=C command sed -ne "/^$cur/{s/ .*$//;p;}"))
65+
_comp_compgen_split -l -- "$(
66+
LC_ALL=C
67+
"$1" --config "$config" --search "^$cur" 2>/dev/null |
68+
command sed -ne "/^$cur/{s/ .*$//;p;}"
69+
)"
6570
fi
6671
} &&
6772
complete -F _comp_cmd_slapt_src slapt-src

0 commit comments

Comments
 (0)