mirror of
https://github.com/spf13/cobra
synced 2025-05-05 04:47:22 +00:00
perf(bash-v2): speed up filtering entries with descriptions
Use simple prefix match instead of single word `compgen -W` command substitution for each candidate match.
This commit is contained in:
parent
f17e5a27c9
commit
ce36da4fef
1 changed files with 1 additions and 2 deletions
|
@ -183,8 +183,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}
|
||||
|
|
Loading…
Add table
Reference in a new issue