From 08b9f8d6770e2f626bca0d320d2b577e0e1597c5 Mon Sep 17 00:00:00 2001 From: ekaragodin Date: Sun, 14 Dec 2014 11:09:34 +0600 Subject: [PATCH 1/3] Added Yii2 command completion --- plugins/yii2/yii2.plugin.zsh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 plugins/yii2/yii2.plugin.zsh diff --git a/plugins/yii2/yii2.plugin.zsh b/plugins/yii2/yii2.plugin.zsh new file mode 100644 index 00000000..137b3a07 --- /dev/null +++ b/plugins/yii2/yii2.plugin.zsh @@ -0,0 +1,29 @@ +# Yii2 command completion + +_yii2_format_command () { + awk '/^- [a-z]+/ { sub(":", "", $2); print $2 }' +} + +_yii2 () { + if [ -f ./yii ]; then + _arguments \ + '1: :->command'\ + '*: :->params' + + case $state in + command) + + local -a commands + local -a name + + if [[ $words[2] == *\/ ]]; then + name=$words[2] + fi + + commands=(${(f)"$(./yii help $name | _yii2_format_command)"}) + compadd -Q -S '' -a -- commands + esac + fi +} + +compdef _yii2 yii From 7488e9b510f0fec31bb05362f8aa97ec857e8962 Mon Sep 17 00:00:00 2001 From: ekaragodin Date: Mon, 15 Dec 2014 08:18:18 +0600 Subject: [PATCH 2/3] Add yii2 readme --- plugins/yii2/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 plugins/yii2/README.md diff --git a/plugins/yii2/README.md b/plugins/yii2/README.md new file mode 100644 index 00000000..345b66eb --- /dev/null +++ b/plugins/yii2/README.md @@ -0,0 +1,7 @@ +# Yii2 autocomplete plugin + +* Adds autocomplete commands and subcommands for yii. + +## Requirements + +Autocomplete works from directory where your `yii` file contains. From 00ff1bbd1c666be789f94c30cfdd837d16d190d8 Mon Sep 17 00:00:00 2001 From: ekaragodin Date: Mon, 15 Dec 2014 21:37:38 +0600 Subject: [PATCH 3/3] Updated Yii2 command completion --- plugins/yii2/yii2.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/yii2/yii2.plugin.zsh b/plugins/yii2/yii2.plugin.zsh index 137b3a07..e8993adf 100644 --- a/plugins/yii2/yii2.plugin.zsh +++ b/plugins/yii2/yii2.plugin.zsh @@ -20,10 +20,10 @@ _yii2 () { name=$words[2] fi - commands=(${(f)"$(./yii help $name | _yii2_format_command)"}) + commands=(${(f)"$(./yii help $name --color=0 | _yii2_format_command)"}) compadd -Q -S '' -a -- commands esac fi } -compdef _yii2 yii +compdef _yii2 yii \ No newline at end of file