-
-
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
No field labels #130
No field labels #130
Conversation
…m command output if they do not want them (e.g. to emit only a single data item with --field=xyzzy --no-field-labels).
This works currently (or at least worked until very recently, my local install is hosed right now) |
It would be interesting to go back in time and see where that worked. It seems like a good solution from a UX point of view. The reason it isn't working now is that --format=key-value (the default for Drush status) will flatten array values into strings (separated by spaces), whereas --format=list does not do this. Maybe these formats could be unified. |
sorry, I was not clear |
@@ -64,6 +64,9 @@ function outputformat_drush_engine_type_info() { | |||
'description' => 'In nested lists of lists, specify how the outer lists ("lines") should be separated.', | |||
'hidden' => TRUE, | |||
), | |||
'no-field-labels' => array( | |||
'description' => 'Leave off the field labels.', |
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 about "Show values without labels. For example, omits table headers, CSV headers, and labels in lists.".
Perhaps add an Example to a command that key-value and another to one that uses table.
Looks good.
|
--format=csv does not print field labels, so it does not need to support a field label control option. I can add the suggested documentation, and I'm fine with renaming this to --field-labels. However, one question about that: what about non-zero values for this option? Should it be possible to use --field-labels to control the labeling of output fields? I'm uncertain of the utility of this, but --field-labels sounds like it is more than just a binary option, and some might expect to be able to use it for something else. I can see putting Maybe it's okay to move forward with --field-labels as just a binary option for now. |
IMO, CSV should be printing field labels like tables do ... Yes, I was thinking a boolean option, just like --strict. |
--field-labels is now handled as a boolean option, defaulting to on, and csv prints field labels like tables do. The above commits introduce a regression: |
All tests are passing now; I think it would be good to get this into 6.1.0, if possible. Strictly speaking, adding field labels to CSV is a behavior change; however, no core Drush commands use csv as the default format, so perhaps the exposure here is low enough to be considered negligible. If it's a concern, then omit edf4d81 and 69220f4 from Drush 6; however, I think I'd rather see Drush 6 and Drush 7 behave consistently here. |
I'm also OK with that behavior change for 6.x. I rebased and squashed the commits onto master. That made sense to me as there was some back and forth about --no-field-labels in the commit history, that I didn't think we needed to preserve. There is a small conflict when cherry-pick onto 6.x. I would appreciate if @greg-1-anderson could resolve and push. Thanks. |
Resolved and pushed to 6.x. |
I'm not seeing field labels for CSV. I tried: |
This is now possible in master branch. See #2460 |
A user may want to see just the command output data, without any extra field labels; it should therefore be possible to tell Drush to omit the field labels.
Example:
The --no-field-labels version could more easily be processed in a bash for loop, for example.