Merge pull request #64 from Mellbourn/fix-negative-comp-words
Including tweaks to conditional statements I think the original conditionals would always be false. That prevents using completions which rely on identifying the penultimate and antepenultimate portions of typed commandline.
This commit is contained in:
commit
9d21376f88
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_CWORD-1))" -ge "0" ]; then
|
||||
penultimate=${COMP_WORDS[COMP_CWORD-1]}
|
||||
fi
|
||||
local antepenultimate
|
||||
if [ "$((COMP_CWORD-2))" -ge "0" ]; then
|
||||
antepenultimate=${COMP_WORDS[COMP_CWORD-2]}
|
||||
fi
|
||||
|
||||
local GIT_DIR
|
||||
# shellcheck disable=SC2034
|
||||
|
|
Loading…
Reference in a new issue