function drush_help_section_formatter_options

8.0.x help.drush.inc drush_help_section_formatter_options($command, &$help_attributes)
6.x help.drush.inc drush_help_section_formatter_options($command, &$help_attributes)
7.x help.drush.inc drush_help_section_formatter_options($command, &$help_attributes)
4.x drush.inc drush_help_section_formatter_options($command, &$help_attributes)
5.x help.drush.inc drush_help_section_formatter_options($command, &$help_attributes)
master helpsingle.drush.inc drush_help_section_formatter_options($command, &$help_attributes)

The options section formatter. Adds a "--" in front of each item label. Also handles short-form and example-value components in the help attributes.

File

commands/core/help.drush.inc, line 190

Code

function drush_help_section_formatter_options($command, &$help_attributes) {
  if ($help_attributes['label'][0] == '-') {
    drush_log(dt("Option '!option' of command !command should instead be declared as '!fixed'", array('!option' => $help_attributes['label'], '!command' => $command['command'], '!fixed' => preg_replace('/^--*/', '', $help_attributes['label']))), 'debug');
  }
  else {
    $help_attributes['label'] = '--' . $help_attributes['label'];
  }
  if (array_key_exists('required', $help_attributes)) {
    $help_attributes['description'] .= " " . dt("Required.");
  }

  $prefix = '<';
  $suffix = '>';
  if (array_key_exists('example-value', $help_attributes)) {
    if (isset($help_attributes['value']) && $help_attributes['value'] == 'optional') {
      $prefix = '[';
      $suffix = ']';
    }
    $help_attributes['label'] .= '=' . $prefix . $help_attributes['example-value'] . $suffix;

    if (array_key_exists('short-form', $help_attributes)) {
      $help_attributes['short-form'] .= " $prefix" . $help_attributes['example-value'] . $suffix;
    }
  }
  if (array_key_exists('short-form', $help_attributes)) {
    $help_attributes['label'] = '-' . $help_attributes['short-form'] . ', ' . $help_attributes['label'];
  }
  drush_help_section_default_formatter($command, $help_attributes);
}