mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-02 02:19:06 +01:00
add simple composer plugin with subcommands completion
This commit is contained in:
parent
e8d582aba9
commit
63346edb1b
2 changed files with 23 additions and 0 deletions
21
plugins/composer/_composer
Normal file
21
plugins/composer/_composer
Normal 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
|
||||
2
plugins/composer/composer.plugin.zsh
Normal file
2
plugins/composer/composer.plugin.zsh
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#alias
|
||||
alias composer="composer.phar"
|
||||
Loading…
Add table
Add a link
Reference in a new issue