Skip to content

Commit ef29727

Browse files
committed
Add example to readme showing how you can get colors working in a custom help screen
1 parent 88b224e commit ef29727

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,16 @@ class InitCommand extends Ahc\Cli\Input\Command
170170
{
171171
parent::__construct('init', 'Init something');
172172

173+
$help = '<cyan>Custom help screen</end>';
174+
$writer = new Ahc\Cli\Output\Writer();
175+
$rendered_help = $writer->colorizer()->colors($help);
176+
173177
$this
174178
->argument('<arrg>', 'The Arrg')
175179
->argument('[arg2]', 'The Arg2')
176180
->option('-a --apple', 'The Apple')
177181
->option('-b --ball', 'The ball')
178-
->help('Custom help screen (if omitted one will be generated)')
182+
->help($rendered_help)
179183
// Usage examples:
180184
->usage(
181185
// append details or explanation of given example with ` ## ` so they will be uniformly aligned when shown

0 commit comments

Comments
 (0)