mirror of
https://github.com/spf13/cobra
synced 2025-05-05 04:47:22 +00:00
fix(bash-v2): copy-pasto regressions in previous commit
This commit is contained in:
parent
94850dafa5
commit
2a4ac58fbd
1 changed files with 5 additions and 5 deletions
|
@ -181,7 +181,7 @@ __%[1]s_handle_standard_completion_case() {
|
|||
# Look for the longest completion so that we can format things nicely
|
||||
while IFS='' read -r compline; do
|
||||
# Strip any description before checking the length
|
||||
comp=${compline%%$tab*}
|
||||
comp=${compline%%%%$tab*}
|
||||
# Only consider the completions that match
|
||||
comp=$(compgen -W "$comp" -- "$cur")
|
||||
[[ -z $comp ]] && continue
|
||||
|
@ -194,11 +194,11 @@ __%[1]s_handle_standard_completion_case() {
|
|||
# If there is a single completion left, remove the description text
|
||||
if [ ${#COMPREPLY[*]} -eq 1 ]; then
|
||||
__%[1]s_debug "COMPREPLY[0]: ${COMPREPLY[0]}"
|
||||
comp="${COMPREPLY[0]%%$tab*}"
|
||||
comp="${COMPREPLY[0]%%%%$tab*}"
|
||||
__%[1]s_debug "Removed description from single completion, which is now: ${comp}"
|
||||
COMPREPLY[0]=$comp
|
||||
else # Format the descriptions
|
||||
__sshi_format_comp_descriptions $longest
|
||||
__%[1]s_format_comp_descriptions $longest
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ __%[1]s_format_comp_descriptions()
|
|||
comp=${COMPREPLY[ci]}
|
||||
# Properly format the description string which follows a tab character if there is one
|
||||
if [[ "$comp" == *$tab* ]]; then
|
||||
__sshi_debug "Original comp: $comp"
|
||||
__%[1]s_debug "Original comp: $comp"
|
||||
desc=${comp#*$tab}
|
||||
comp=${comp%%%%$tab*}
|
||||
|
||||
|
@ -256,7 +256,7 @@ __%[1]s_format_comp_descriptions()
|
|||
comp+=" ($desc)"
|
||||
fi
|
||||
COMPREPLY[ci]=$comp
|
||||
__sshi_debug "Final comp: $comp"
|
||||
__%[1]s_debug "Final comp: $comp"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue