add simple composer plugin with subcommands completion

This commit is contained in:
Natrim 2012-06-20 11:14:24 +02:00
commit 63346edb1b
2 changed files with 23 additions and 0 deletions

View file

@ -0,0 +1,21 @@
#simple composer subcommand completion
#compdef composer.phar
#autoload
local -a _1st_arguments
if [ -f composer.phar ]; then
_1st_arguments=(`./composer.phar --no-ansi | sed "1,/Available commands/d" | awk '{ printf $1":"; for (i = 2; i <= NF; i++) printf "%s\xc2\xa0",$i; printf "\n" }'`)
else
if which composer.phar &> /dev/null; then
_1st_arguments=(`composer.phar --no-ansi | sed "1,/Available commands/d" | awk '{ printf $1":"; for (i = 2; i <= NF; i++) printf "%s\xc2\xa0",$i; printf "\n" }'`)
fi
fi
_arguments \
'*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then
_describe -t commands "composer.phar subcommand" _1st_arguments
return
fi

View file

@ -0,0 +1,2 @@
#alias
alias composer="composer.phar"