-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Feature Request
Describe your use case and the problem you are facing
This is a small feature request, which Co-pilot might be capable of adding, if approved. At the moment, one can retrieve an alias definition by running a command such as this:
wp cli alias get @some-alias
This returns output similar to this:
path: public_html
ssh: server.dreamhost.com
What I would like to be able to do is to retrieve one specific property of the alias definition (e.g., just "path"). While it's possible, and trivial, to use a combination of shell commands (awk with grep come to mind), I'm envisioning that WP-CLI could do this natively via an optional property argument like so:
wp cli alias get @some-alias path
The output would look like this:
public_html
One case that I'm not sure how to handle is requesting a non-existent property. I'm imagining it returns empty standard output and exits with status 1. Alternatively, instead of failing quietly, it could output an error such as this:
wp cli alias get @some-alias user
Error: The property "user" does not exist for "@some-alias".
I think, for now, only one property can be passed at a time. I don't envision something like this:
wp cli alias get @some-alias property1,property2
By that point, it's little different from requesting all properties, and if one wanted to parse them, we'd resort to awk and grep or some other mechanism.