Skip to content

Commit

Permalink
perf(bash-v2): speed up filtering entries with descriptions (#1689)
Browse files Browse the repository at this point in the history
Use simple prefix match instead of single word `compgen -W` command
substitution for each candidate match.
  • Loading branch information
scop committed May 4, 2022
1 parent 95d7df1 commit fb80311
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions bash_completionsV2.go
Expand Up @@ -191,8 +191,7 @@ __%[1]s_handle_standard_completion_case() {
# Strip any description before checking the length
comp=${compline%%%%$tab*}
# Only consider the completions that match
comp=$(compgen -W "$comp" -- "$cur")
[[ -z $comp ]] && continue
[[ $comp == "$cur"* ]] || continue
COMPREPLY+=("$compline")
if ((${#comp}>longest)); then
longest=${#comp}
Expand Down

0 comments on commit fb80311

Please sign in to comment.