mirror of
https://github.com/spf13/cobra.git
synced 2024-11-15 01:38:17 -07:00
Allow bash-completion to work with full-path executable
This commit is contained in:
parent
1ef0913976
commit
65a708cee0
@ -183,7 +183,11 @@ __handle_command()
|
||||
if [[ -n ${last_command} ]]; then
|
||||
next_command="_${last_command}_${words[c]//:/__}"
|
||||
else
|
||||
next_command="_${words[c]//:/__}"
|
||||
if [[ $c -eq 0 ]]; then
|
||||
next_command="_$(basename ${words[c]//:/__})"
|
||||
else
|
||||
next_command="_${words[c]//:/__}"
|
||||
fi
|
||||
fi
|
||||
c=$((c+1))
|
||||
__debug "${FUNCNAME}: looking for ${next_command}"
|
||||
@ -201,6 +205,8 @@ __handle_word()
|
||||
__handle_flag
|
||||
elif __contains_word "${words[c]}" "${commands[@]}"; then
|
||||
__handle_command
|
||||
elif [[ $c -eq 0 ]] && __contains_word "$(basename ${words[c]})" "${commands[@]}"; then
|
||||
__handle_command
|
||||
else
|
||||
__handle_noun
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user