44
55use Inhere \Console \Controller ;
66use Inhere \Console \IO \Input ;
7- use Inhere \Console \Utils \AnsiCode ;
8- use Inhere \Console \Utils \Download ;
7+ use Inhere \Console \Components \AnsiCode ;
8+ use Inhere \Console \Components \Download ;
99use Inhere \Console \Utils \Helper ;
1010use Inhere \Console \Utils \Interact ;
1111use Inhere \Console \Utils \Show ;
@@ -150,13 +150,20 @@ public function progressCommand($input)
150150 }
151151
152152 /**
153- * output more format message text
153+ * output format message: title
154154 */
155- public function fmtMsgCommand ()
155+ public function titleCommand ()
156156 {
157157 $ this ->output ->title ('title show ' );
158- echo "\n" ;
159158
159+ return 0 ;
160+ }
161+
162+ /**
163+ * output format message: section
164+ */
165+ public function sectionCommand ()
166+ {
160167 $ body = 'If screen size could not be detected, or the indentation is greater than the screen size, the text will not be wrapped. ' .
161168 'Word wrap text with indentation to fit the screen size, ' .
162169 'Word wrap text with indentation to fit the screen size, ' .
@@ -167,17 +174,31 @@ public function fmtMsgCommand()
167174 'pos ' => 'l '
168175 ]);
169176
177+ return 0 ;
178+ }
179+
180+ /**
181+ * output format message: panel
182+ */
183+ public function panelCommand ()
184+ {
170185 $ data = [
171186 'application version ' => '1.2.0 ' ,
172187 'system version ' => '5.2.3 ' ,
173188 'see help ' => 'please use php bin/app -h ' ,
174189 'a only value message text ' ,
175190 ];
191+
176192 Show::panel ($ data , 'panel show ' , [
177193 'borderChar ' => '# '
178194 ]);
195+ }
179196
180- echo "\n" ;
197+ /**
198+ * output format message: helpPanel
199+ */
200+ public function helpPanelCommand ()
201+ {
181202 Show::helpPanel ([
182203 Show::HELP_DES => 'a help panel description text. (help panel show) ' ,
183204 Show::HELP_USAGE => 'a usage text ' ,
@@ -192,35 +213,30 @@ public function fmtMsgCommand()
192213 '-h, --help ' => 'Display this help message '
193214 ],
194215 ], false );
216+ }
217+
218+ /**
219+ * output format message: aList
220+ */
221+ public function aListCommand ()
222+ {
223+ $ list = [
224+ 'The is a list line 0 ' ,
225+ 'The is a list line 1 ' ,
226+ 'The is a list line 2 ' ,
227+ 'The is a list line 3 ' ,
228+ ];
229+
230+ Show::aList ($ list , 'a List show(No key) ' );
195231
196232 $ commands = [
197233 'version ' => 'Show application version information ' ,
198234 'help ' => 'Show application help information ' ,
199235 'list ' => 'List all group and independent commands ' ,
200236 'a only value message text '
201237 ];
202- Show::aList ($ commands , 'a List show ' );
203238
204- Show::table ([
205- [
206- 'id ' => 1 ,
207- 'name ' => 'john ' ,
208- 'status ' => 2 ,
209- 210- ],
211- [
212- 'id ' => 2 ,
213- 'name ' => 'tom ' ,
214- 'status ' => 0 ,
215- 216- ],
217- [
218- 'id ' => 3 ,
219- 'name ' => 'jack ' ,
220- 'status ' => 1 ,
221- 222- ],
223- ], 'table show ' );
239+ Show::aList ($ commands , 'a List show(Has key) ' );
224240 }
225241
226242 /**
@@ -323,7 +339,7 @@ public function jsonCommand()
323339 $ this ->output ->dump ($ data );
324340
325341 $ this ->output ->write ('use print: ' );
326- $ this ->output ->print ($ data );
342+ $ this ->output ->prints ($ data );
327343
328344 $ this ->output ->write ('use json: ' );
329345 $ this ->output ->json ($ data );
@@ -350,6 +366,7 @@ public function useArgCommand()
350366
351367 /**
352368 * command `defArgCommand` config
369+ * @throws \LogicException
353370 */
354371 protected function defArgConfigure ()
355372 {
@@ -369,7 +386,7 @@ public function defArgCommand()
369386 }
370387
371388 /**
372- * use <red>Interact::confirm</red> method
389+ * This is a demo for use <red>Interact::confirm</red> method
373390 */
374391 public function confirmCommand ()
375392 {
@@ -379,7 +396,7 @@ public function confirmCommand()
379396 }
380397
381398 /**
382- * example for use <magenta>Interact::select</magenta> method
399+ * This is a demo for use <magenta>Interact::select</magenta> method
383400 */
384401 public function selectCommand ()
385402 {
@@ -406,16 +423,16 @@ public function envCommand()
406423 }
407424
408425 /**
409- * download a file to local
426+ * This is a demo for download a file to local
410427 * @usage {command} url=url saveTo=[saveAs] type=[bar|text]
411- * @example {command} url=https://github.com/inhere/php-librarys /archive/v2.0.1 .zip type=bar
428+ * @example {command} url=https://github.com/inhere/php-console /archive/master .zip type=bar
412429 */
413430 public function downCommand ()
414431 {
415432 $ url = $ this ->input ->getArg ('url ' );
416433
417434 if (!$ url ) {
418- Show:: error ('Please input you want to downloaded file url, use: url=[url] ' , 1 );
435+ $ this -> output -> liteError ('Please input you want to downloaded file url, use: url=[url] ' , 1 );
419436 }
420437
421438 $ saveAs = $ this ->input ->getArg ('saveAs ' );
@@ -425,7 +442,7 @@ public function downCommand()
425442 $ saveAs = __DIR__ . '/ ' . basename ($ url );
426443 }
427444
428- $ goon = Interact::confirm ("Now, will download $ url to $ saveAs, go on " );
445+ $ goon = Interact::confirm ("Now, will download $ url \n to dir $ saveAs, go on " );
429446
430447 if (!$ goon ) {
431448 Show::notice ('Quit download, Bye! ' );
@@ -435,13 +452,13 @@ public function downCommand()
435452
436453 $ d = Download::down ($ url , $ saveAs , $ type );
437454
438- echo Helper::dumpVars ($ d );
455+ // echo Helper::dumpVars($d);
439456
440457 return 0 ;
441458 }
442459
443460 /**
444- * show cursor move on the screen
461+ * This is a demo for show cursor move on the screen
445462 */
446463 public function cursorCommand ()
447464 {
0 commit comments