@@ -39,7 +39,8 @@ class BrefSpinner
3939 ];
4040 private int $ startTime ;
4141 private string $ message ;
42- private int $ currentFrame = 0 ;
42+ private ?string $ extraMessage = null ;
43+ private int $ currentFrame = 7 ;
4344 private bool $ started = true ;
4445 private string $ timerId ;
4546 private ?Cursor $ cursor ;
@@ -81,7 +82,7 @@ public function advance(): void
8182 /**
8283 * Finish the indicator with message.
8384 */
84- public function finish (string $ message ): void
85+ public function finish (string $ message, ? string $ extraMessage = null ): void
8586 {
8687 if (! $ this ->started ) throw new LogicException ('Progress indicator has not yet been started. ' );
8788
@@ -91,6 +92,7 @@ public function finish(string $message): void
9192
9293 $ this ->currentFrame = 5 ;
9394 $ this ->message = $ message ;
95+ $ this ->extraMessage = $ extraMessage ;
9496 $ this ->render ();
9597 $ this ->output ->writeln ('' );
9698 $ this ->started = false ;
@@ -114,7 +116,13 @@ public function render(): void
114116 $ frame = Styles::blue ('⠷ ' );
115117 }
116118
117- $ line = ' ' . $ frame . ' ' . $ this ->message . Styles::gray (' › ' . $ this ->formatTime (time () - $ this ->startTime ));
119+ $ timeFormatted = $ this ->formatTime (time () - $ this ->startTime );
120+ if ($ this ->extraMessage ) {
121+ // Finished with success
122+ $ line = Styles::gray ($ timeFormatted . ' › ' ) . $ this ->message . Styles::gray (' › ' ) . $ this ->extraMessage ;
123+ } else {
124+ $ line = ' ' . $ frame . ' ' . $ this ->message . Styles::gray (' › ' . $ timeFormatted );
125+ }
118126 $ this ->overwrite ($ line );
119127
120128 $ this ->previousMessage = $ this ->message ;
0 commit comments