@@ -2,6 +2,7 @@ import * as c from "ansi-colors";
2
2
3
3
import { Job } from "./job" ;
4
4
import { Parser } from "./parser" ;
5
+ import { Utils } from "./utils" ;
5
6
6
7
export class Commander {
7
8
@@ -27,10 +28,12 @@ export class Commander {
27
28
}
28
29
29
30
if ( skippingNever . length > 0 ) {
30
- process . stdout . write ( `${ skippingNever . map ( ( j ) => j . name ) . join ( ', ' ) } ${ c . magentaBright ( "skipped" ) } when:never\n` ) ;
31
+ skippingNever . forEach ( Utils . printJobNames ) ;
32
+ process . stdout . write ( ` ${ c . magentaBright ( "skipped" ) } when:never\n` ) ;
31
33
}
32
34
if ( skippingManual . length > 0 ) {
33
- process . stdout . write ( `${ skippingManual . map ( ( j ) => j . name ) . join ( ', ' ) } ${ c . magentaBright ( "skipped" ) } when:manual\n` ) ;
35
+ skippingManual . forEach ( Utils . printJobNames ) ;
36
+ process . stdout . write ( ` ${ c . magentaBright ( "skipped" ) } when:manual\n` ) ;
34
37
}
35
38
36
39
let stage = stages . shift ( ) ;
@@ -196,52 +199,33 @@ export class Commander {
196
199
}
197
200
}
198
201
199
- let terminalLength = 0 ;
200
- const printJobName = ( job : Job , i : number , arr : Job [ ] ) => {
201
- terminalLength += job . name . length ;
202
- if ( terminalLength > 180 ) {
203
- process . stdout . write ( `\n${ "" . padEnd ( 2 ) } ` ) ;
204
- terminalLength = 0 ;
205
- }
206
- if ( i === arr . length - 1 ) {
207
- process . stdout . write ( `${ c . blueBright ( `${ job . name } ` ) } ` ) ;
208
- } else {
209
- process . stdout . write ( `${ c . blueBright ( `${ job . name } ` ) } , ` ) ;
210
- }
211
- } ;
212
-
213
202
if ( preScripts . never . length !== 0 ) {
214
203
process . stdout . write ( `${ c . magenta ( "not started" ) } ` ) ;
215
- terminalLength = 0 ;
216
- preScripts . never . forEach ( printJobName ) ;
204
+ preScripts . never . forEach ( Utils . printJobNames ) ;
217
205
process . stdout . write ( `\n` ) ;
218
206
}
219
207
220
208
if ( preScripts . successful . length !== 0 ) {
221
209
process . stdout . write ( `${ c . green ( "successful" ) } ` ) ;
222
- terminalLength = 0 ;
223
- preScripts . successful . forEach ( printJobName ) ;
210
+ preScripts . successful . forEach ( Utils . printJobNames ) ;
224
211
process . stdout . write ( `\n` ) ;
225
212
}
226
213
227
214
if ( preScripts . warned . length !== 0 ) {
228
215
process . stdout . write ( `${ c . yellowBright ( "warning" ) } ` ) ;
229
- terminalLength = 0 ;
230
- preScripts . warned . forEach ( printJobName ) ;
216
+ preScripts . warned . forEach ( Utils . printJobNames ) ;
231
217
process . stdout . write ( `\n` ) ;
232
218
}
233
219
234
220
if ( afterScripts . warned . length !== 0 ) {
235
221
process . stdout . write ( `${ c . yellowBright ( "after script" ) } ` ) ;
236
- terminalLength = 0 ;
237
- afterScripts . warned . forEach ( printJobName ) ;
222
+ afterScripts . warned . forEach ( Utils . printJobNames ) ;
238
223
process . stdout . write ( `\n` ) ;
239
224
}
240
225
241
226
if ( preScripts . failed . length !== 0 ) {
242
227
process . stdout . write ( `${ c . red ( "failure" ) } ` ) ;
243
- terminalLength = 0 ;
244
- preScripts . failed . forEach ( printJobName ) ;
228
+ preScripts . failed . forEach ( Utils . printJobNames ) ;
245
229
process . stdout . write ( `\n` ) ;
246
230
}
247
231
0 commit comments