-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --filter to many commands #3718
Conversation
It might be possible to make the I don't think it would be too bad to have to add the annotation to commands that need it. |
I updated the documentation for filter-via-dot-access-data to illustrate how "contains" and "regex" searches are done. |
… roll commands a bit (not perfect yet).
… complex expression now.
The
|
…best guess; perhaps we should not define a default field unless the use-case for it is clear.
docs/output-filters.md
Outdated
@@ -0,0 +1,36 @@ | |||
Output Filters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for writing this ... I have two thoughts. I don't know how to handle them though.
- Output filters sounds a lot like output formats which is a related but different concept. Everyone is going to mix them up.
- Might be worth saying how this feature differs from grep and when to use each.
I resolved this by making one topic on adjusting command output. It covers output formats, output fields and output filters together. Since all of these options are related to the same concept, it should be clear if folks can read about them together.
Haven't worked this in yet.
Something akin to that could go in the introduction, or maybe at the top of the "output filters" section. |
…ation is present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the option help text --filter[=FILTER] Filter output based on provided expression
would benefit from an example. It could be a generic example --filter=<fieldname>=foo
or customized for that command <display_name*=Ctools>
.
That brings up a question do the = and *= operators perform case insensitive comparisons? I think I would prefer that.
Also, I think the value is required for all these options, not just --field:
--format[=FORMAT]
--field=FIELD
--filter[=FILTER]
@@ -31,6 +31,7 @@ | |||
* @command {{ machine_name }}:token | |||
* @aliases token | |||
* | |||
* @filter-output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should declare a default field instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we pick which field is the default field? Assume id
and let the user change it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case I would go with “name”. This is just an example method. It’s not dynamically adjusted or anything.
glossary | ||
``` | ||
|
||
Output Filters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking that this topic should be offerred automatically in help for any command that shows the --fields option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
…d that defines field labels or filters.
The Regarding |
I think I've done about as much as I intend to do here for now. I recommend that we first release Drush 9.5.0, and then merge this PR to the master branch so that folks can try it out in the dev release for a while before calling it stable. |
@@ -31,6 +31,7 @@ | |||
* @command {{ machine_name }}:token | |||
* @aliases token | |||
* | |||
* @filter-output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case I would go with “name”. This is just an example method. It’s not dynamically adjusted or anything.
@@ -112,6 +112,7 @@ public function entityUpdates($options = ['cache-clear' => true]) | |||
* description: Description | |||
* type: Type | |||
* @default-fields module,update_id,type,description | |||
* @filter-default-field module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think 'type' would be a better default field here.
Before I merge here, I need to add an example to the |
…. Fine-tune a couple default fields for the filter option.
2f29ac5
to
86d9967
Compare
This should be ready to go after tests pass. |
Just one field: