Created
May 2, 2023 16:44
-
-
Save peterjaffray/0f2bdc0b297a87d5aada90e62816e11d to your computer and use it in GitHub Desktop.
wp-cli completions for fish cli //~/.config/fish/completions/wp.fish
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function __wp_complete | |
set -l old_ifs $IFS | |
set -l cur (commandline -ct) | |
set IFS \n | |
set -l opts (wp cli completions --line=(commandline) --point=(commandline -C)) | |
if string match -q --regex "\<file\>\s*" $opts | |
return (commandline -f) | |
else if test -z "$opts" | |
return (commandline -f) | |
else | |
for opt in $opts | |
printf '%s\n' $opt | |
end | |
end | |
set IFS $old_ifs | |
end | |
complete -c wp -f -a "(__wp_complete)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment