1515use Inhere \Console \Contract \CommandInterface ;
1616use Inhere \Console \IO \Input ;
1717use Inhere \Console \IO \Output ;
18- use Inhere \Console \Util \FormatUtil ;
1918use Inhere \Console \Util \Show ;
2019use Toolkit \Cli \Color \ColorTag ;
2120use Toolkit \Cli \Style ;
21+ use Toolkit \PFlag \FlagUtil ;
2222use function array_merge ;
2323use function basename ;
2424use function date ;
@@ -138,7 +138,7 @@ public function showHelpInfo(string $command = ''): void
138138 $ binName = $ in ->getScriptName ();
139139 $ helpInfo = [
140140 'Usage ' => "$ binName <info>{command}</info> [--opt -v -h ...] [arg0 arg1 arg2=value2 ...] " ,
141- 'Options ' => FormatUtil ::alignOptions ($ globalOptions ),
141+ 'Options ' => FlagUtil ::alignOptions ($ globalOptions ),
142142 'Example ' => [
143143 '- run a command/subcommand: ' ,
144144 "$ binName test run a independent command " ,
@@ -215,11 +215,11 @@ public function showCommandList(): void
215215
216216 $ placeholder = 'No description of the command ' ;
217217 foreach ($ groups as $ name => $ info ) {
218- $ options = $ info ['options ' ];
219218 $ controller = $ info ['handler ' ];
220219 /** @var AbstractHandler $controller */
221220 $ desc = $ controller ::getDesc () ?: $ placeholder ;
222- $ aliases = $ options ['aliases ' ];
221+ $ config = $ info ['config ' ];
222+ $ aliases = $ config ['aliases ' ];
223223 $ extra = $ aliases ? ColorTag::wrap (' (alias: ' . implode (', ' , $ aliases ) . ') ' , 'info ' ) : '' ;
224224
225225 // collect
@@ -231,22 +231,22 @@ public function showCommandList(): void
231231 }
232232
233233 foreach ($ commands as $ name => $ info ) {
234- $ desc = $ placeholder ;
235- $ options = $ info ['options ' ];
234+ $ desc = $ placeholder ;
235+ $ config = $ info ['config ' ];
236236 $ command = $ info ['handler ' ];
237237
238238 /** @var AbstractHandler $command */
239239 if (is_subclass_of ($ command , CommandInterface::class)) {
240240 $ desc = $ command ::getDesc () ?: $ placeholder ;
241- } elseif ($ msg = $ options ['desc ' ] ?? '' ) {
241+ } elseif ($ msg = $ config ['desc ' ] ?? '' ) {
242242 $ desc = $ msg ;
243243 } elseif (is_string ($ command )) {
244244 $ desc = 'A handler : ' . $ command ;
245245 } elseif (is_object ($ command )) {
246246 $ desc = 'A handler by ' . get_class ($ command );
247247 }
248248
249- $ aliases = $ options ['aliases ' ];
249+ $ aliases = $ config ['aliases ' ];
250250 $ extra = $ aliases ? ColorTag::wrap (' (alias: ' . implode (', ' , $ aliases ) . ') ' , 'info ' ) : '' ;
251251
252252 $ commandArr [$ name ] = $ desc . $ extra ;
@@ -281,7 +281,7 @@ public function showCommandList(): void
281281
282282 Show::mList ([
283283 'Usage: ' => "$ scriptName <info>{COMMAND}</info> [--opt -v -h ...] [arg0 arg1 arg2=value2 ...] " ,
284- 'Options: ' => FormatUtil ::alignOptions ($ globOpts ),
284+ 'Options: ' => FlagUtil ::alignOptions ($ globOpts ),
285285 'Internal Commands: ' => $ internalCommands ,
286286 'Available Commands: ' => array_merge ($ groupArr , $ commandArr ),
287287 ], [
0 commit comments