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.
pull/4/merge
Tim Byrne 7 years ago
commit 9d21376f88
No known key found for this signature in database
GPG Key ID: 14DB4FC2465A4B12

@ -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…
Cancel
Save