Skip to content

Instantly share code, notes, and snippets.

@peterjaffray
Created May 2, 2023 16:44
Show Gist options
  • Save peterjaffray/0f2bdc0b297a87d5aada90e62816e11d to your computer and use it in GitHub Desktop.
Save peterjaffray/0f2bdc0b297a87d5aada90e62816e11d to your computer and use it in GitHub Desktop.
wp-cli completions for fish cli //~/.config/fish/completions/wp.fish
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