1010
1111use Inhere \Console \Component \Style \Style ;
1212use Toolkit \Cli \Cli ;
13+ use Toolkit \Cli \ColorTag ;
1314use Toolkit \StrUtil \Str ;
1415use Toolkit \StrUtil \StrBuffer ;
1516use Toolkit \Sys \Sys ;
@@ -331,7 +332,7 @@ public static function padding(array $data, string $title = null, array $opts =
331332 return ;
332333 }
333334
334- $ string = $ title ? Helper:: wrapTag (ucfirst ($ title ), 'comment ' ) . ": \n" : '' ;
335+ $ string = $ title ? ColorTag:: wrap (ucfirst ($ title ), 'comment ' ) . ": \n" : '' ;
335336 $ opts = array_merge ([
336337 'char ' => '. ' ,
337338 'indent ' => ' ' ,
@@ -343,7 +344,7 @@ public static function padding(array $data, string $title = null, array $opts =
343344 $ paddingLen = $ keyMaxLen > $ opts ['padding ' ] ? $ keyMaxLen : $ opts ['padding ' ];
344345
345346 foreach ($ data as $ label => $ value ) {
346- $ value = Helper:: wrapTag ((string )$ value , $ opts ['valueStyle ' ]);
347+ $ value = ColorTag:: wrap ((string )$ value , $ opts ['valueStyle ' ]);
347348 $ string .= $ opts ['indent ' ] . str_pad ($ label , $ paddingLen , $ opts ['char ' ]) . " $ value \n" ;
348349 }
349350
@@ -380,7 +381,7 @@ public static function aList($data, string $title = null, array $opts = [])
380381 // title
381382 if ($ title ) {
382383 $ title = ucwords (trim ($ title ));
383- $ string .= Helper:: wrapTag ($ title , $ opts ['titleStyle ' ]) . PHP_EOL ;
384+ $ string .= ColorTag:: wrap ($ title , $ opts ['titleStyle ' ]) . PHP_EOL ;
384385 }
385386
386387 // handle item list
@@ -843,7 +844,7 @@ public static function table(array $data, string $title = 'Data Table', array $o
843844 foreach ($ head as $ index => $ name ) {
844845 $ colMaxWidth = $ info ['columnMaxWidth ' ][$ index ];
845846 $ name = \str_pad ($ name , $ colMaxWidth , ' ' );
846- $ name = Helper:: wrapTag ($ name , $ opts ['headStyle ' ]);
847+ $ name = ColorTag:: wrap ($ name , $ opts ['headStyle ' ]);
847848 $ headStr .= " {$ name } {$ colBorderChar }" ;
848849 }
849850
@@ -867,7 +868,7 @@ public static function table(array $data, string $title = 'Data Table', array $o
867868 foreach ((array )$ row as $ value ) {
868869 $ colMaxWidth = $ info ['columnMaxWidth ' ][$ colIndex ];
869870 $ value = \str_pad ($ value , $ colMaxWidth , ' ' );
870- $ value = Helper:: wrapTag ($ value , $ opts ['bodyStyle ' ]);
871+ $ value = ColorTag:: wrap ($ value , $ opts ['bodyStyle ' ]);
871872 $ rowStr .= " {$ value } {$ colBorderChar }" ;
872873 $ colIndex ++;
873874 }
@@ -1452,7 +1453,7 @@ public static function color($message, string $style = 'info', $nl = true, array
14521453 {
14531454 $ quit = isset ($ opts ['quit ' ]) ? (bool )$ opts ['quit ' ] : false ;
14541455
1455- return self ::write (Helper:: wrapTag ($ message , $ style ), $ nl , $ quit , $ opts );
1456+ return self ::write (ColorTag:: wrap ($ message , $ style ), $ nl , $ quit , $ opts );
14561457 }
14571458
14581459 /**
@@ -1493,6 +1494,6 @@ public static function getBlockMethods($onlyKey = true): array
14931494 */
14941495 public static function getStyle (): Style
14951496 {
1496- return Style::create ();
1497+ return Style::instance ();
14971498 }
14981499}
0 commit comments