File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1+ # Fish completion for the `wp` command
2+ # Check $fish_complete_path for possible install locations
3+ # Or check the documentation:
4+ # https://fishshell.com/docs/current/completions.html#where-to-put-completions
5+
6+ function __wp_cli_complete
7+ # Get current buffer and cursor
8+ set --local COMP_LINE (commandline )
9+ set --local COMP_POINT (commandline -C )
10+
11+ # Get valid completions from wp-cli
12+ set --local opts (wp cli completions --line =$COMP_LINE --point =$COMP_POINT )
13+
14+ # wp-cli will indicate if it needs a file
15+ if string match -qe " <file> " -- $opts
16+ command ls -1
17+ else
18+ # Remove unnecessary double spaces that wp-cli splits options with
19+ string trim -- $opts
20+ # `string` echoes each result on a newline.
21+ # Which is then collected for use with the `-a` flag for `complete`.
22+ end
23+ end
24+ complete -f -a " (__wp_cli_complete)" wp
You can’t perform that action at this time.
0 commit comments