@@ -9,6 +9,12 @@ export const symbols = {
99 warn : pc . yellow ( "⚠" ) ,
1010} ;
1111
12+ let _silentMode = false ;
13+
14+ export const setSilentMode = ( silent : boolean ) => {
15+ _silentMode = silent ;
16+ } ;
17+
1218export const ui = {
1319 // Formatters
1420 path : ( value : string ) => {
@@ -24,19 +30,25 @@ export const ui = {
2430 pad : ( value : string , length : number ) => value . padEnd ( length ) ,
2531
2632 // Components
27- line : ( text : string = "" ) => process . stdout . write ( `${ text } \n` ) ,
33+ line : ( text : string = "" ) => {
34+ if ( _silentMode ) return ;
35+ process . stdout . write ( `${ text } \n` ) ;
36+ } ,
2837
2938 header : ( label : string , value : string ) => {
39+ if ( _silentMode ) return ;
3040 process . stdout . write ( `${ pc . blue ( "ℹ" ) } ${ label . padEnd ( 10 ) } ${ value } \n` ) ;
3141 } ,
3242
3343 item : ( icon : string , label : string , details ?: string ) => {
44+ if ( _silentMode ) return ;
3445 const partLabel = pc . bold ( label ) ;
3546 const partDetails = details ? pc . gray ( details ) : "" ;
3647 process . stdout . write ( ` ${ icon } ${ partLabel } ${ partDetails } \n` ) ;
3748 } ,
3849
3950 step : ( action : string , subject : string , details ?: string ) => {
51+ if ( _silentMode ) return ;
4052 const icon = pc . cyan ( "→" ) ;
4153 process . stdout . write (
4254 ` ${ icon } ${ action } ${ pc . bold ( subject ) } ${ details ? ` ${ pc . dim ( details ) } ` : "" } \n` ,
0 commit comments