2449e41248f03f4313e67294883cb928d597ad27

Author
Andrew Dwyer <andrewrdwyer@gmail.com>
Committer
Andrew Dwyer <andrewrdwyer@gmail.com>
Date

Message

Add file completion as optional argument

Diff

 1diff --git a/plugins/n98-magerun/n98-magerun.plugin.zsh b/plugins/n98-magerun/n98-magerun.plugin.zsh
 2index 3a29f39b343ea63ac54d7c9845dade5e9570a96e..bfcf27b984ada059662eb28f559671b72863e3fe 100755
 3--- a/plugins/n98-magerun/n98-magerun.plugin.zsh
 4+++ b/plugins/n98-magerun/n98-magerun.plugin.zsh
 5@@ -7,11 +7,19 @@
 6 
 7 # n98-magerun basic command completion
 8 _n98_magerun_get_command_list () {
 9-  n98-magerun.phar --no-ansi | sed "1,/Available commands/d" | awk '/^ +[a-z\-:]+/ { print $1 }'
10+  $_comp_command1 --no-ansi | sed "1,/Available commands/d" | awk '/^ +[a-z\-:]+/ { print $1 }'
11 }
12 
13+
14 _n98_magerun () {
15-  compadd `_n98_magerun_get_command_list`
16+  _arguments '1: :->command' '*:optional arg:_files'
17+
18+  case $state in
19+    command)
20+      compadd $(_n98_magerun_get_command_list)
21+      ;;
22+    *)
23+  esac
24 }
25 
26 compdef _n98_magerun n98-magerun.phar