66use inhere \console \io \Input ;
77use inhere \console \utils \AnsiCode ;
88use inhere \console \utils \Download ;
9+ use inhere \console \utils \Helper ;
910use inhere \console \utils \Show ;
1011use inhere \console \utils \Interact ;
1112
@@ -60,10 +61,9 @@ public function colorCommand()
6061 return 0 ;
6162 }
6263
64+ $ this ->write ('color text output: ' );
6365 $ styles = $ this ->output ->getStyle ()->getStyleNames ();
64- $ this ->write ('normal text output ' );
6566
66- $ this ->write ('color text output ' );
6767 foreach ($ styles as $ style ) {
6868 $ this ->output ->write ("< $ style> $ style style text</ $ style> " );
6969 }
@@ -90,24 +90,30 @@ public function blockMsgCommand()
9090 * a progress bar example show
9191 *
9292 * @options
93+ * --type the progress type, allow: bar,txt. default <cyan>txt</cyan>
9394 * --done-char the done show char. default <info>=</info>
9495 * --wait-char the waiting show char. default <info>-</info>
9596 * --sign-char the sign char show. default <info>></info>
9697 * @example
9798 * {script} home/progress
9899 * {script} home/progress --done-char '#' --wait-char ' '
100+ * @param Input $input
99101 * @return int
100102 */
101103 public function progressCommand ($ input )
102104 {
103105 $ i = 0 ;
104106 $ total = 120 ;
105- $ bar = $ this ->output ->progressBar ($ total , [
106- 'msg ' => 'Msg Text ' ,
107- 'doneChar ' => $ input ->getOpt ('done-char ' , '= ' ),
108- 'waitChar ' => $ input ->getOpt ('wait-char ' , '- ' ),
109- 'signChar ' => $ input ->getOpt ('sign-char ' , '> ' ),
110- ]);
107+ if ($ input ->getOpt ('type ' ) === 'bar ' ) {
108+ $ bar = $ this ->output ->progressBar ($ total , [
109+ 'msg ' => 'Msg Text ' ,
110+ 'doneChar ' => $ input ->getOpt ('done-char ' , '= ' ),
111+ 'waitChar ' => $ input ->getOpt ('wait-char ' , '- ' ),
112+ 'signChar ' => $ input ->getOpt ('sign-char ' , '> ' ),
113+ ]);
114+ } else {
115+ $ bar = $ this ->output ->progressTxt ($ total , 'Doing df df ' , 'Done ' );
116+ }
111117
112118 $ this ->write ('Progress: ' );
113119
@@ -194,16 +200,17 @@ public function fmtMsgCommand()
194200 /**
195201 * a example for use arguments on command
196202 * @usage home/useArg [arg1=val1 arg2=arg2] [options]
197- * @example home/useArg status=2 name=john arg0 -s=test --page=23 -d -rf --debug --test=false
198- * home/useArg status=2 name=john name=tom name=jack arg0 -s=test --page=23 --id=23 --id=154 --id=456 -d -rf --debug --test=false
203+ * @example
204+ * home/useArg status=2 name=john arg0 -s=test --page=23 -d -rf --debug --test=false
205+ * home/useArg status=2 name=john name=tom name=jack arg0 -s=test --page=23 --id=23 --id=154 --id=456 -d -rf --debug --test=false
199206 */
200207 public function useArgCommand ()
201208 {
202209 $ this ->write ('input arguments: ' );
203- var_dump ($ this ->input ->getArgs ());
210+ echo Helper:: dumpVar ($ this ->input ->getArgs ());
204211
205212 $ this ->write ('input options: ' );
206- var_dump ($ this ->input ->getOpts ());
213+ echo Helper:: dumpVar ($ this ->input ->getOpts ());
207214
208215 // $this->write('the Input object:');
209216 // var_dump($this->input);
@@ -277,7 +284,7 @@ public function downCommand()
277284
278285 $ d = Download::down ($ url , $ saveAs , $ type );
279286
280- var_dump ($ d );
287+ echo Helper:: dumpVar ($ d );
281288
282289 return 0 ;
283290 }
0 commit comments