Skip to content

Commit afc3f5a

Browse files
committed
v 0.123.1
Autocomplete : use local wpcli exec.
1 parent e3795e0 commit afc3f5a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

inc/autocomplete.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ _wputools_complete() {
1515
local _base_wp_dir_plugins="${_base_wp_dir_content}plugins";
1616
local _list_backup_dir=( "../backups/" "../" "../local-backups/" );
1717
local _backup_extensions=( ".tar.gz" ".sql" ".sql.gz" );
18+
local _WPCLIPATH="$( dirname "${BASH_SOURCE[0]}" )/../wp-cli.phar";
1819

1920
COMPREPLY=()
2021
cur=${COMP_WORDS[COMP_CWORD]}
@@ -63,7 +64,7 @@ _wputools_complete() {
6364
COMPREPLY=( $(compgen -W "$(cat "${_WPUTOOLS_PLUGIN_LIST}" "${_WPUTOOLS_PLUGIN_FAV_LIST}")" -- $cur) )
6465
;;
6566
"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);
6768
COMPREPLY=( $(compgen -W "all comment help user wptest ${_reply}" -- $cur) );
6869
;;
6970
"update")
@@ -75,7 +76,7 @@ _wputools_complete() {
7576
;;
7677
"wp")
7778
# 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);
7980
COMPREPLY=( $(compgen -W "${_reply}" -- $cur) );
8081
;;
8182
"wpuwoo")
@@ -94,7 +95,7 @@ _wputools_complete() {
9495
local _tmp_reply='foreach (WP_CLI::get_root_command()->get_subcommands() as $name => $details) {if($name == "';
9596
_tmp_reply+=$prev;
9697
_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);
9899
COMPREPLY=( $(compgen -W "${_reply}" -- $cur) );
99100
fi;
100101

wputools.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
WPUTools(){
44

5-
local _WPUTOOLS_VERSION='0.123.0';
5+
local _WPUTOOLS_VERSION='0.123.1';
66
local _PHP_VERSIONS=(7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4 8.5 9.0)
77
local _PHP_VERSIONS_OBSOLETES=(7.0 7.1 7.2 7.3 7.4 8.0)
88
local _PHP_VERSIONS_ADVANCED=(8.3 8.4 8.5 9.0)

0 commit comments

Comments
 (0)