fix for getting 'COMP_WORDS bad array subscript' on completing yadm
I stared getting these errors when pressing tab after 'yadm '. This seems to be due to COMP_CWORD being negative, so this is the fix I applied
This commit is contained in:
parent
246eab8b52
commit
708b491d88
1 changed files with 8 additions and 2 deletions
|
@ -9,8 +9,14 @@ if declare -F _git > /dev/null; then
|
|||
_yadm() {
|
||||
|
||||
local current=${COMP_WORDS[COMP_CWORD]}
|
||||
local penultimate=${COMP_WORDS[COMP_CWORD-1]}
|
||||
local antepenultimate=${COMP_WORDS[COMP_CWORD-2]}
|
||||
local penultimate
|
||||
if (($COMP_WORDS > 0)); then
|
||||
penultimate=${COMP_WORDS[COMP_CWORD-1]}
|
||||
fi
|
||||
local antepenultimate
|
||||
if (($COMP_WORDS > 1)); then
|
||||
antepenultimate=${COMP_WORDS[COMP_CWORD-2]}
|
||||
fi
|
||||
|
||||
local GIT_DIR
|
||||
# shellcheck disable=SC2034
|
||||
|
|
Loading…
Reference in a new issue