summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobby Russell <robby@planetargon.com>2015-02-22 10:22:55 -0800
committerRobby Russell <robby@planetargon.com>2015-02-22 10:22:55 -0800
commit07ebfd84aba2e3d649354ed3ad197e24cb53b568 (patch)
tree6987cc3cd4ad9cd8569599122d5ba06956e88dcc
parent9c0b6430273caa15ca9752eed955c3e7106d82a3 (diff)
parentb2f8764855e14d113bb2cfd1cd788bd7baaae05a (diff)
downloadzsh-07ebfd84aba2e3d649354ed3ad197e24cb53b568.tar.gz
zsh-07ebfd84aba2e3d649354ed3ad197e24cb53b568.tar.bz2
zsh-07ebfd84aba2e3d649354ed3ad197e24cb53b568.zip
Merge pull request #3497 from hsingh23/patch-1
Adds completions to wp-cli plugin
-rw-r--r--plugins/wp-cli/wp-cli.plugin.zsh22
1 files changed, 22 insertions, 0 deletions
diff --git a/plugins/wp-cli/wp-cli.plugin.zsh b/plugins/wp-cli/wp-cli.plugin.zsh
index ac430b7a2..6c70a7a09 100644
--- a/plugins/wp-cli/wp-cli.plugin.zsh
+++ b/plugins/wp-cli/wp-cli.plugin.zsh
@@ -136,3 +136,25 @@ alias wpwd='wp widget delete'
alias wpwl='wp widget list'
alias wpwm='wp widget move'
alias wpwu='wp widget update'
+
+
+autoload -U +X bashcompinit && bashcompinit
+# bash completion for the `wp` command
+
+_wp_complete() {
+ local cur=${COMP_WORDS[COMP_CWORD]}
+
+ IFS=$'\n'; # want to preserve spaces at the end
+ local opts="$(wp cli completions --line="$COMP_LINE" --point="$COMP_POINT")"
+
+ if [[ "$opts" =~ \<file\>\s* ]]
+ then
+ COMPREPLY=( $(compgen -f -- $cur) )
+ elif [[ $opts = "" ]]
+ then
+ COMPREPLY=( $(compgen -f -- $cur) )
+ else
+ COMPREPLY=( ${opts[*]} )
+ fi
+}
+complete -o nospace -F _wp_complete wp