File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,7 +49,8 @@ public function __construct(Colors $colors = null)
4949 '' => array (
5050 'opts ' => array (),
5151 'args ' => array (),
52- 'help ' => ''
52+ 'help ' => '' ,
53+ 'commandhelp ' => 'This tool accepts a command as first parameter as outlined below: '
5354 )
5455 ); // default command
5556
@@ -352,8 +353,8 @@ public function help()
352353 $ text = '' ;
353354
354355 $ hascommands = (count ($ this ->setup ) > 1 );
355- $ commandhelp = $ this ->setup ["" ]["commandhelp " ]
356- ?: ' This tool accepts a command as first parameter as outlined below: ' ;
356+ $ commandhelp = $ this ->setup ['' ]["commandhelp " ];
357+
357358 foreach ($ this ->setup as $ command => $ config ) {
358359 $ hasopts = (bool )$ this ->setup [$ command ]['opts ' ];
359360 $ hasargs = (bool )$ this ->setup [$ command ]['args ' ];
Original file line number Diff line number Diff line change @@ -76,4 +76,15 @@ function test_complex()
7676 $ this ->assertTrue ($ options ->getOpt ('long ' ));
7777 $ this ->assertEquals (array ('foo ' ), $ options ->args );
7878 }
79+
80+ function test_commandhelp ()
81+ {
82+ $ options = new Options ();
83+ $ options ->registerCommand ('cmd ' , 'a command ' );
84+ $ this ->assertStringContainsString ('accepts a command as first parameter ' , $ options ->help ());
85+
86+ $ options ->setCommandHelp ('foooooobaar ' );
87+ $ this ->assertStringNotContainsString ('accepts a command as first parameter ' , $ options ->help ());
88+ $ this ->assertStringContainsString ('foooooobaar ' , $ options ->help ());
89+ }
7990}
You can’t perform that action at this time.
0 commit comments