mirror of
https://github.com/spf13/cobra
synced 2025-05-05 12:57:22 +00:00
Only consider matching completions for formatting
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
This commit is contained in:
parent
98cc4b0c79
commit
6d86d9185a
1 changed files with 2 additions and 0 deletions
|
@ -154,6 +154,8 @@ __%[1]s_handle_standard_completion_case() {
|
||||||
while IFS='' read -r comp; do
|
while IFS='' read -r comp; do
|
||||||
# Strip any description before checking the length
|
# Strip any description before checking the length
|
||||||
comp=${comp%%%%$tab*}
|
comp=${comp%%%%$tab*}
|
||||||
|
# Only consider the completions that match
|
||||||
|
comp=$(compgen -W "$comp" -- "$cur")
|
||||||
if ((${#comp}>longest)); then
|
if ((${#comp}>longest)); then
|
||||||
longest=${#comp}
|
longest=${#comp}
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue