@@ -98,38 +98,39 @@ public function pack(Input $input, Output $output): int
9898 $ cpr ->onError (function ($ error ) {
9999 output ()->writeln ("<warning> $ error</warning> " );
100100 });
101+ $ cpr ->on (PharCompiler::ON_MESSAGE , function ($ msg ) {
102+ output ()->colored ('> ' . $ msg );
103+ });
101104
102- $ counter = null ;
105+ $ output -> colored ( ' Collect Pack files ' , ' comment ' ) ;
103106 if ($ input ->getOpt ('debug ' )) {
104- $ output ->info ('Pack file to Phar ... ... ' );
105- $ cpr ->onAdd (function ($ path ) {
107+ // $output->info('Pack file to Phar ... ...');
108+ $ cpr ->onAdd (function (string $ path ) {
106109 output ()->writeln (" <info>+</info> $ path " );
107110 });
108111
109112 $ cpr ->on ('skip ' , function (string $ path , bool $ isFile ) {
110- output ()->writeln (" <red>-</red> $ path " . ($ isFile ? '[F] ' : '[D] ' ));
113+ $ mark = $ isFile ? '[F] ' : '[D] ' ;
114+ output ()->writeln (" <red>-</red> $ path <info> $ mark</info> " );
111115 });
112116 } else {
113- $ output ->info ('Pack file to Phar: ' );
114- $ counter = Show::counterTxt ('<info>File Packing ...</info> ' , 'Done. ' );
117+ $ counter = Show::counterTxt ('Collecting ... ' , 'Done. ' );
115118 $ cpr ->onAdd (function () use ($ counter ) {
116119 $ counter ->send (1 );
117120 });
121+ $ cpr ->on (PharCompiler::ON_COLLECTED , function () use ($ counter ) {
122+ $ counter ->send (-1 );
123+ });
118124 }
119125
120126 // packing ...
121127 $ refresh = $ input ->getBoolOpt ('refresh ' );
122128 $ cpr ->pack ($ pharFile , $ refresh );
123129
124- // end
125- if ($ counter ) {
126- $ counter ->send (-1 );
127- }
128-
129130 $ info = [
130131 PHP_EOL . '<success>Phar Build Completed!</success> ' ,
131- " - Phar file : $ pharFile " ,
132- ' - Phar size : ' . round (filesize ($ pharFile ) / 1024 / 1024 , 2 ) . ' Mb ' ,
132+ " - Phar File : $ pharFile " ,
133+ ' - Phar Size : ' . round (filesize ($ pharFile ) / 1024 / 1024 , 2 ) . ' Mb ' ,
133134 ' - Pack Time: ' . round (microtime (true ) - $ startAt , 3 ) . ' s ' ,
134135 ' - Pack File: ' . $ cpr ->getCounter (),
135136 ' - Commit ID: ' . $ cpr ->getLastCommit (),
0 commit comments