Skip to content

Commit

Permalink
Improve global options keys in Help
Browse files Browse the repository at this point in the history
  • Loading branch information
weitzman committed Oct 19, 2022
1 parent b980ffb commit b9c9c32
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function configureGlobalOptions()

$this->getDefinition()
->addOption(
new InputOption('--uri', '-l', InputOption::VALUE_REQUIRED, 'A base URL for building links and selecting a multi-site. Defaults to https://default.')
new InputOption('--uri', '-l', InputOption::VALUE_REQUIRED, 'A base URL for building links and selecting a multi-site. Defaults to <info>https://default</info>.')
);

$this->getDefinition()
Expand Down
7 changes: 2 additions & 5 deletions src/Commands/core/MkCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,8 @@ protected static function appendOptionsGlobal($application): string
if (!in_array($key, HelpCLIFormatter::OPTIONS_GLOBAL_IMPORTANT)) {
continue;
}
$name = '--' . $key;
if ($value->getShortcut()) {
$name = '-' . $name . ', ' . $value->getShortcut();
}
$body .= '- ** ' . $name . '**. ' . self::cliTextToMarkdown($value->getDescription()) . "\n";
// The values don't go through standard formatting since we want to show http://default not the uri that was used when running this command.
$body .= '- ** ' . HelpCLIFormatter::formatOptionKeys(self::optionToArray($value)) . '**. ' . self::cliTextToMarkdown($value->getDescription()) . "\n";
}
$body .= '- To see all global options, run <code>drush topic</code> and pick the first choice.' . "\n";
$body = "#### Global Options\n\n$body\n";
Expand Down
3 changes: 2 additions & 1 deletion src/Commands/help/HelpCLIFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Consolidation\OutputFormatters\Formatters\FormatterInterface;
use Consolidation\OutputFormatters\Options\FormatterOptions;
use Consolidation\OutputFormatters\StructuredData\RowsOfFields;
use Drush\Commands\core\MkCommands;
use Drush\Drush;
use Symfony\Component\Console\Output\OutputInterface;

Expand Down Expand Up @@ -74,7 +75,7 @@ public function write(OutputInterface $output, $data, FormatterOptions $options)
$name = '-' . $value->getShortcut() . ', ' . $name;
}
$rows[] = [
$name,
$this->formatOptionKeys(MkCommands::optionToArray($value)),
$value->getDescription(),
];
}
Expand Down

0 comments on commit b9c9c32

Please sign in to comment.