You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe your use case and the problem you are facing
I'd like to be able to differentiate between the two types of WP CLI aliases: ones that resolve to a single site's definition (which we'll call a "singleton" alias), and ones that resolve to one or more aliases (which we'll call a "group" alias). This would be useful for scripting purposes.
An example might help. Let's say that I have the following aliases:
Now let's say that one is a single instance of WordPress, and two is a multi-site instance of WordPress. There are a number of commands that require an extra flag to work on a multi-site ("--network"). For example, activating a plugin. The following command will succeed for "one" and fail for "two":
$ wp @both plugin activate some-plugin
It fails for "two" because it lacks the "--network" flag.
Describe the solution you'd like
I know I can use the shell and grep to address this problem, but it would be nice if it were addressed in WP CLI itself.
I have one proposal in two flavors: create a new command to determine whether an alias is a group: wp cli alias is-group (returns 0 on true, 1 on false). This is similar to other commands such as wp core is-installed or wp plugin is-active). Or wp cli alias get-type (returns string "group" or "single"). With this command in a script, some conditional processing can be done when dealing with either a singleton or group alias.
The text was updated successfully, but these errors were encountered:
Feature Request
Describe your use case and the problem you are facing
I'd like to be able to differentiate between the two types of WP CLI aliases: ones that resolve to a single site's definition (which we'll call a "singleton" alias), and ones that resolve to one or more aliases (which we'll call a "group" alias). This would be useful for scripting purposes.
An example might help. Let's say that I have the following aliases:
Now let's say that one is a single instance of WordPress, and two is a multi-site instance of WordPress. There are a number of commands that require an extra flag to work on a multi-site ("--network"). For example, activating a plugin. The following command will succeed for "one" and fail for "two":
It fails for "two" because it lacks the "--network" flag.
Describe the solution you'd like
I know I can use the shell and grep to address this problem, but it would be nice if it were addressed in WP CLI itself.
I have one proposal in two flavors: create a new command to determine whether an alias is a group:
wp cli alias is-group
(returns 0 on true, 1 on false). This is similar to other commands such aswp core is-installed
orwp plugin is-active
). Orwp cli alias get-type
(returns string "group" or "single"). With this command in a script, some conditional processing can be done when dealing with either a singleton or group alias.The text was updated successfully, but these errors were encountered: