@@ -40,6 +40,7 @@ protected static function commandAliases()
4040 'af ' => 'artFont ' ,
4141 'ml ' => 'multiList ' ,
4242 'ms ' => 'multiSelect ' ,
43+ 'sl ' => 'splitLine ' ,
4344 ];
4445 }
4546
@@ -75,10 +76,31 @@ public function testCommand()
7576 $ this ->write ('hello, welcome!! this is ' . __METHOD__ );
7677 }
7778
79+ /**
80+ * command `defArgCommand` config
81+ * @throws \LogicException
82+ */
83+ protected function defArgConfigure ()
84+ {
85+ $ this ->createDefinition ()
86+ ->setDescription ('the command arg/opt config use defined configure, it like symfony console: argument define by position ' )
87+ ->addArgument ('name ' , Input::ARG_REQUIRED , "description for the argument 'name' " )
88+ ->addOption ('yes ' , 'y ' , Input::OPT_BOOLEAN , "description for the option 'yes' " )
89+ ->addOption ('opt1 ' , null , Input::OPT_REQUIRED , "description for the option 'opt1' " );
90+ }
91+
92+ /**
93+ * the command arg/opt config use defined configure, it like symfony console: argument define by position
94+ */
95+ public function defArgCommand ()
96+ {
97+ $ this ->output ->dump ($ this ->input ->getArgs (), $ this ->input ->getOpts (), $ this ->input ->getBoolOpt ('y ' ));
98+ }
99+
78100 /**
79101 * a example for highlight code
80102 * @options
81- * --ln With line number
103+ * --ln Display with line number
82104 * @param Input $in
83105 */
84106 public function highlightCommand ($ in )
@@ -210,6 +232,21 @@ public function pendingCommand()
210232 Show::pending ('Done ' , true );
211233 }
212234
235+ /**
236+ * dynamic notice message show: pointing
237+ */
238+ public function pointingCommand ()
239+ {
240+ $ total = 100 ;
241+
242+ while ($ total --) {
243+ Show::pointing ();
244+ usleep (10000 );
245+ }
246+
247+ Show::pointing ('Done ' , true );
248+ }
249+
213250 /**
214251 * a progress bar example show, by Show::progressBar()
215252 * @options
@@ -280,6 +317,20 @@ public function titleCommand()
280317 return 0 ;
281318 }
282319
320+ /**
321+ * output format message: splitLine
322+ * @options
323+ * -w, --width WIDTH The split line width. default is current screen width.
324+ */
325+ public function splitLineCommand ()
326+ {
327+ $ this ->output ->splitLine ('split Line ' , '- ' , $ this ->input ->getSameOpt (['w ' , 'width ' ], 0 ));
328+
329+ $ this ->output ->splitLine ('split 中文 Line ' , '- ' , $ this ->input ->getSameOpt (['w ' , 'width ' ], 0 ));
330+
331+ return 0 ;
332+ }
333+
283334 /**
284335 * output format message: section
285336 */
@@ -540,27 +591,6 @@ public function useArgCommand()
540591 // var_dump($this->input);
541592 }
542593
543- /**
544- * command `defArgCommand` config
545- * @throws \LogicException
546- */
547- protected function defArgConfigure ()
548- {
549- $ this ->createDefinition ()
550- ->setDescription ('the command arg/opt config use defined configure, it like symfony console: argument define by position ' )
551- ->addArgument ('name ' , Input::ARG_REQUIRED , 'description for the argument [name] ' )
552- ->addOption ('yes ' , 'y ' , Input::OPT_BOOLEAN , 'description for the option [yes] ' )
553- ->addOption ('opt1 ' , null , Input::OPT_REQUIRED , 'description for the option [opt1] ' );
554- }
555-
556- /**
557- * the command arg/opt config use defined configure, it like symfony console: argument define by position
558- */
559- public function defArgCommand ()
560- {
561- $ this ->output ->dump ($ this ->input ->getArgs (), $ this ->input ->getOpts (), $ this ->input ->getBoolOpt ('y ' ));
562- }
563-
564594 /**
565595 * This is a demo for use <magenta>Interact::confirm</magenta> method
566596 */
0 commit comments