Skip to content

Commit

Permalink
Merge pull request #3497 from hsingh23/patch-1
Browse files Browse the repository at this point in the history
Adds completions to wp-cli plugin
  • Loading branch information
robbyrussell committed Feb 22, 2015
2 parents 9c0b643 + b2f8764 commit 07ebfd8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions plugins/wp-cli/wp-cli.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 07ebfd8

Please sign in to comment.