@@ -15,6 +15,7 @@ _wputools_complete() {
15
15
local _base_wp_dir_plugins=" ${_base_wp_dir_content} plugins" ;
16
16
local _list_backup_dir=( " ../backups/" " ../" " ../local-backups/" );
17
17
local _backup_extensions=( " .tar.gz" " .sql" " .sql.gz" );
18
+ local _WPCLIPATH=" $( dirname " ${BASH_SOURCE[0]} " ) /../wp-cli.phar" ;
18
19
19
20
COMPREPLY=()
20
21
cur=${COMP_WORDS[COMP_CWORD]}
@@ -63,7 +64,7 @@ _wputools_complete() {
63
64
COMPREPLY=( $( compgen -W " $( cat " ${_WPUTOOLS_PLUGIN_LIST} " " ${_WPUTOOLS_PLUGIN_FAV_LIST} " ) " -- $cur ) )
64
65
;;
65
66
" sample" )
66
- _reply=$( wp post-type list --public=1 --fields=name --format=csv 2> /dev/null | tail -n +2) ;
67
+ _reply=$( " ${_WPCLIPATH} " post-type list --public=1 --fields=name --format=csv 2> /dev/null | tail -n +2) ;
67
68
COMPREPLY=( $( compgen -W " all comment help user wptest ${_reply} " -- $cur ) );
68
69
;;
69
70
" update" )
@@ -75,7 +76,7 @@ _wputools_complete() {
75
76
;;
76
77
" wp" )
77
78
# Thanks to https://github.com/wp-cli/wp-cli/issues/6012
78
- _reply=$( echo ' foreach (WP_CLI::get_root_command()->get_subcommands() as $name => $details) { echo $name. " "; }' | wp shell) ;
79
+ _reply=$( echo ' foreach (WP_CLI::get_root_command()->get_subcommands() as $name => $details) { echo $name. " "; }' | " ${_WPCLIPATH} " shell) ;
79
80
COMPREPLY=( $( compgen -W " ${_reply} " -- $cur ) );
80
81
;;
81
82
" wpuwoo" )
@@ -94,7 +95,7 @@ _wputools_complete() {
94
95
local _tmp_reply=' foreach (WP_CLI::get_root_command()->get_subcommands() as $name => $details) {if($name == "' ;
95
96
_tmp_reply+=$prev ;
96
97
_tmp_reply+=' ") {foreach ($details->get_subcommands() as $subname => $subdetails) { echo $subname. " "; } }} ' ;
97
- _reply=$( echo " ${_tmp_reply} " | wp shell) ;
98
+ _reply=$( echo " ${_tmp_reply} " | " ${_WPCLIPATH} " shell) ;
98
99
COMPREPLY=( $( compgen -W " ${_reply} " -- $cur ) );
99
100
fi ;
100
101
0 commit comments