Skip to content
Myr

perf(bash-v2): speed up filtering entries with descriptions (#1689)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Use simple prefix match instead of single word `compgen -W` command substitution for each candidate match.

authored by Ville Skyttä · committed by GitHub · parent 95d7df1 · Browse files · 1 file+1 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−2 removed

  • other:+1 added−2 removed

1 file+1 added−2 removed

modified:bash_completionsV2.go+1 added-2 removed
189 unmodified lines
190 while IFS='' read -r compline; do191 # Strip any description before checking the length192 comp=${compline%%%%$tab*}193 # Only consider the completions that match194 comp=$(compgen -W "$comp" -- "$cur")195 [[ -z $comp ]] && continue194 [[ $comp == "$cur"* ]] || continue195 COMPREPLY+=("$compline")196 if ((${#comp}>longest)); then197 longest=${#comp}198 fi
129 unmodified lines