Skip to content

Commit 0444090

Browse files
committed
Merge pull request #3 from thorstenk/compatibility_capistrano2
Check capistrano version to select proper argument
2 parents f72ba9f + a3a6d3d commit 0444090

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cap

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,16 @@ _cap()
1111
return
1212
fi
1313

14+
local cap_opt_all
15+
cap --version | grep 'Capistrano v2.' > /dev/null
16+
if [ $? -eq 0 ]; then
17+
cap_opt_all='-v' # Capistrano 2.x
18+
else
19+
cap_opt_all='-A' # Capistrano 3.x
20+
fi
21+
1422
local opts
15-
opts=`cap -T -A | awk 'BEGIN {x=1}; $x>1 { if($1=="cap") { print $2}}'`
23+
opts=`cap -T ${cap_opt_all} | awk 'BEGIN {x=1}; $x>1 { if($1=="cap") { print $2}}'`
1624
optscolon=${cur%"${cur##*:}"}
1725

1826
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}))

0 commit comments

Comments
 (0)