Skip to content

Commit

Permalink
#8: If a field's human-readable name differs from its machine name, t…
Browse files Browse the repository at this point in the history
…hen show both in the help text output
  • Loading branch information
greg-1-anderson committed Aug 24, 2013
1 parent 3fc72e5 commit 9f93502
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions commands/core/outputformat.drush.inc
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,20 @@ function outputformat_drush_help_alter(&$command) {
// then modify the help for --fields to include
// specific information about the available fields.
if (isset($outputformat['field-labels'])) {
$all_fields = array_keys($outputformat['field-labels']);
$all_fields = array();
$all_fields_description = array();
foreach ($outputformat['field-labels'] as $field => $human_readable) {
$all_fields[] = $field;
if ((strtolower($field) != strtolower($human_readable)) && !array_key_exists(strtolower($human_readable), $outputformat['field-labels'])) {
$all_fields_description[] = $field . dt(" (or '!other')", array('!other' => strtolower($human_readable)));
}
else {
$all_fields_description[] = $field;
}
}
$field_defaults = isset($outputformat['fields-default']) ? $outputformat['fields-default'] : $all_fields;
$command['options']['fields']['example-value'] = implode(', ', $field_defaults);
$command['options']['fields']['description'] .= ' '. dt('All available fields are: !fields.', array('!fields' => implode(', ', $all_fields)));
$command['options']['fields']['description'] .= ' '. dt('All available fields are: !fields.', array('!fields' => implode(', ', $all_fields_description)));
if (isset($outputformat['fields-default'])) {
$command['options']['full']['description'] = dt("Show the full output, with all fields included.");
}
Expand Down

0 comments on commit 9f93502

Please sign in to comment.