File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,8 @@ public function __construct(Colors $colors = null)
49
49
'' => array (
50
50
'opts ' => array (),
51
51
'args ' => array (),
52
- 'help ' => ''
52
+ 'help ' => '' ,
53
+ 'commandhelp ' => 'This tool accepts a command as first parameter as outlined below: '
53
54
)
54
55
); // default command
55
56
@@ -352,8 +353,8 @@ public function help()
352
353
$ text = '' ;
353
354
354
355
$ 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
+
357
358
foreach ($ this ->setup as $ command => $ config ) {
358
359
$ hasopts = (bool )$ this ->setup [$ command ]['opts ' ];
359
360
$ hasargs = (bool )$ this ->setup [$ command ]['args ' ];
Original file line number Diff line number Diff line change @@ -76,4 +76,15 @@ function test_complex()
76
76
$ this ->assertTrue ($ options ->getOpt ('long ' ));
77
77
$ this ->assertEquals (array ('foo ' ), $ options ->args );
78
78
}
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
+ }
79
90
}
You can’t perform that action at this time.
0 commit comments