Merge pull request #415 from websi/capistrano_v3

Add the compatibility for capistrano gem version 3
pull/556/head
Nils Winkler 2015-08-27 08:13:40 +02:00
commit 2b483010d2
1 changed files with 8 additions and 1 deletions

View File

@ -7,7 +7,14 @@ _capcomplete() {
if [ -f Capfile ]; then if [ -f Capfile ]; then
recent=`ls -t .cap_tasks~ Capfile **/*.cap 2> /dev/null | head -n 1` recent=`ls -t .cap_tasks~ Capfile **/*.cap 2> /dev/null | head -n 1`
if [[ $recent != '.cap_tasks~' ]]; then if [[ $recent != '.cap_tasks~' ]]; then
cap --tool --tasks | cut -d " " -f 2 > .cap_tasks~ cap --version | grep 'Capistrano v2.' > /dev/null
if [ $? -eq 0 ]; then
# Capistrano 2.x
cap --tool --verbose --tasks | cut -d " " -f 2 > .cap_tasks~
else
# Capistrano 3.x
cap --all --tasks | cut -d " " -f 2 > .cap_tasks~
fi
fi fi
COMPREPLY=($(compgen -W "`cat .cap_tasks~`" -- ${COMP_WORDS[COMP_CWORD]})) COMPREPLY=($(compgen -W "`cat .cap_tasks~`" -- ${COMP_WORDS[COMP_CWORD]}))
return 0 return 0