diff options
author | Andrew Dwyer <andrewrdwyer@gmail.com> | 2015-05-09 15:43:30 +0930 |
---|---|---|
committer | Andrew Dwyer <andrewrdwyer@gmail.com> | 2015-05-09 15:43:30 +0930 |
commit | 2449e41248f03f4313e67294883cb928d597ad27 (patch) | |
tree | 687926275f533247b42d34007d0ff7efd8a62fea /plugins | |
parent | de769058b9bb846cdbda8eadfde7ebc1bad3993d (diff) | |
download | zsh-2449e41248f03f4313e67294883cb928d597ad27.tar.gz zsh-2449e41248f03f4313e67294883cb928d597ad27.tar.bz2 zsh-2449e41248f03f4313e67294883cb928d597ad27.zip |
Add file completion as optional argument
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/n98-magerun/n98-magerun.plugin.zsh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/n98-magerun/n98-magerun.plugin.zsh b/plugins/n98-magerun/n98-magerun.plugin.zsh index 3a29f39b3..bfcf27b98 100755 --- a/plugins/n98-magerun/n98-magerun.plugin.zsh +++ b/plugins/n98-magerun/n98-magerun.plugin.zsh @@ -7,11 +7,19 @@ # n98-magerun basic command completion _n98_magerun_get_command_list () { - n98-magerun.phar --no-ansi | sed "1,/Available commands/d" | awk '/^ +[a-z\-:]+/ { print $1 }' + $_comp_command1 --no-ansi | sed "1,/Available commands/d" | awk '/^ +[a-z\-:]+/ { print $1 }' } + _n98_magerun () { - compadd `_n98_magerun_get_command_list` + _arguments '1: :->command' '*:optional arg:_files' + + case $state in + command) + compadd $(_n98_magerun_get_command_list) + ;; + *) + esac } compdef _n98_magerun n98-magerun.phar |