extension-command icon indicating copy to clipboard operation
extension-command copied to clipboard

wp theme list show multiple status

Open wpbullet opened this issue 5 years ago • 3 comments

I am creating an audit script and noticed that you cannot use more than one status with the wp theme list command.

Here is an example on a live site:

wp theme list

Output

+----------------+--------+--------+---------+
| name           | status | update | version |
+----------------+--------+--------+---------+
| woodmart-child | active | none   | 1.0.0   |
| woodmart       | parent | none   | 4.4.0   |
+----------------+--------+--------+---------+

I can filter by one status

wp theme list --status=active

Output

+----------------+--------+--------+---------+
| name           | status | update | version |
+----------------+--------+--------+---------+
| woodmart-child | active | none   | 1.0.0   |
+----------------+--------+--------+---------+

But if I try to get both the active and parent status in one command it fails

wp theme list --status=active,parent

Output

+------+--------+--------+---------+
| name | status | update | version |
+------+--------+--------+---------+
+------+--------+--------+---------+

wpbullet avatar Apr 06 '20 13:04 wpbullet

Sounds like it might be looking for a status called active,parent and not actually doing any splitting to filter by both.

So this would be more of an enhancement. I'd be open to accept a PR that covers all relevant commands and also clearly documents the behavior. Would also be good to check other commands as well to ensure they all behave similarly.

swissspidy avatar Nov 10 '23 17:11 swissspidy

@swissspidy IMO It's hard to guess whether the user wants to pass comma-separated strings as multiple strings or the string itself contains the comma. In this case, we can explore the strategy to pass a flag multiple times in case multiple values are intended for a flag.

Example:

$ wp --flag=option1 --flag=option2
# It will be parsed by CLI as `$flag = [ 'option1', 'option2' ]`

$ wp --flag=option1,option2
# It will be parsed by CLI as `$flag = [ 'option1,option2' ]`

thelovekesh avatar Nov 10 '23 17:11 thelovekesh

Related https://github.com/wp-cli/extension-command/issues/159

danielbachhuber avatar Nov 11 '23 00:11 danielbachhuber