Skip to content

Commit fb80311

Browse files
authored
perf(bash-v2): speed up filtering entries with descriptions (#1689)
Use simple prefix match instead of single word `compgen -W` command substitution for each candidate match.
1 parent 95d7df1 commit fb80311

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Diff for: bash_completionsV2.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,7 @@ __%[1]s_handle_standard_completion_case() {
191191
# Strip any description before checking the length
192192
comp=${compline%%%%$tab*}
193193
# Only consider the completions that match
194-
comp=$(compgen -W "$comp" -- "$cur")
195-
[[ -z $comp ]] && continue
194+
[[ $comp == "$cur"* ]] || continue
196195
COMPREPLY+=("$compline")
197196
if ((${#comp}>longest)); then
198197
longest=${#comp}

0 commit comments

Comments
 (0)