Skip to content

Support multiple values on "plugin list --status=X" #194

Closed

Description

@Athanasius

Feature Request

I wish to find all not inactive plugins and themes for a site. If I use "wp plugin list --status=active" I'll miss any that are "active-network", and vice versa. I'm using "--format=json" so can't simply grep the output lines.

Obviously I could pass the JSON output through something like jq as a workaround, but the ability to do something like "wp plugin list --status=active,active-network" would negate the need for the extra processing. Alternatively "wp plugin --status=!inactive" or the like would also work.

Yes, some care needs to be taken with the separator or negation operator to ensure they're not legal characters in WP plugins (or themes).

Activity

  1. schlessera commented on Aug 25, 2019

    @schlessera
    Member

    I think it makes sense to accept a comma-separated list here for multiple status values.

    Would you be interested in providing a pull request for this, @Athanasius ?

  2. Athanasius commented on Aug 25, 2019

    @Athanasius
    Author

    Given my use case "--status=!inactive" would be the more useful, although I'm sure others would have use cases for multiple positive filters.

    Unfortunately the whole reason I was using WP CLI in the first place was so as to avoid needing to develop in PHP. I'm unqualified to provide a patch for this.

  3. schlessera commented on Aug 25, 2019

    @schlessera
    Member

    --status=!inactive will be more difficult to parse and will not as easily be adapted for other flags/commands. Allowing for a set of multiple elements as a first iteration is much more straight-forward in terms of implementation.

    Unfortunately the whole reason I was using WP CLI in the first place was so as to avoid needing to develop in PHP. I'm unqualified to provide a patch for this.

    That's perfectly fine! We'll see whether other people might find inspiration here to provide a patch. Given the usefulness and applicability to other commands, I might even consider writing this one myself if I find the time.

  4. xyulex commented on Oct 23, 2019

    @xyulex

    @schlessera I would like to give it a go. It's the first issue I am trying to do, so be patient... :)

  5. schlessera commented on Oct 23, 2019

    @schlessera
    Member

    @xyulex Yes, no problem. Just let me know if you need assistance.

  6. xyulex commented on Oct 23, 2019

    @xyulex

    @schlessera I have started having a look at it and found where WPCLI return all the status for a certain plugin but can't find where does it do the filtering for showing the final table at the formatter.

  7. schlessera commented on Oct 23, 2019

    @schlessera
    Member
  8. xyulex commented on Oct 23, 2019

    @xyulex

    OK, thanks, I just found it.

  9. schlessera commented on Oct 24, 2019

    @schlessera
    Member

    @xyulex You seem to be on the right track (from what I can see in the commits here), but you're removing the original logic in the process. This breaks everything but the status field.

    You need to add to the existing logic, instead of replacing it.

  10. xyulex commented on Oct 24, 2019

    @xyulex

    The first commit broke everything, then I checked if the parameter was 'status'. I think that's corrected in ( #edcf08 ). At least, the commands work on it. I will keep checking it. Thanks for your feedback.

  11. zaantar commented on Jun 4, 2020

    @zaantar
    Contributor

    I'll give it a try, if that's ok.

  12. added 4 commits that reference this issue on Jun 4, 2020
  13. added a commit that references this issue on Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions