@@ -20,6 +20,7 @@ import { Observable, Observer } from 'rxjs'
20
20
import { Arguments , Streamable } from '@kui-shell/core'
21
21
22
22
import Options from './options'
23
+ import Provider from './Provider'
23
24
import checkers from './registrar'
24
25
import Group , { GroupPriority } from './Group'
25
26
import Checker , { CheckerArgs , CheckResult , Stdout } from './Checker'
@@ -34,19 +35,27 @@ export function success() {
34
35
return ` ${ colors . green ( '\u2713' ) } `
35
36
}
36
37
37
- export function formatLabel < T extends CheckResult > ( label : Checker [ 'label' ] , checkResult : T ) : string {
38
+ export function formatLabel < T extends CheckResult > ( { label, service } : Checker , checkResult : T , color = true ) : string {
38
39
const labelText = typeof label === 'string' ? label : label ( checkResult )
39
40
40
- return labelText // .replace(/^([^:]+:)/, (_, p1) => colors.cyan(p1))
41
+ const A = Provider [ service . provider ]
42
+ const B = service . label
43
+ const C = labelText
44
+
45
+ const AA = color ? colors . dim ( colors . blue ( A ) ) : A
46
+ const BB = color ? colors . dim ( colors . blue ( B ) ) : B
47
+ const CC = C
48
+
49
+ return `${ AA } ${ BB ? ` ${ BB } ` : '' } : ${ CC } ` // .replace(/^([^:]+:)/, (_, p1) => colors.cyan(p1))
41
50
}
42
51
43
52
type Status = { ok : boolean ; message : string }
44
53
45
- async function toStatus ( { label } : Checker , checkResultP : ReturnType < Checker [ 'check' ] > ) : Promise < Status > {
54
+ async function toStatus ( checker : Checker , checkResultP : ReturnType < Checker [ 'check' ] > ) : Promise < Status > {
46
55
const checkResult = await checkResultP
47
56
return {
48
57
ok : typeof checkResult === 'string' || checkResult === true ,
49
- message : formatLabel ( label , checkResult )
58
+ message : formatLabel ( checker , checkResult )
50
59
}
51
60
}
52
61
@@ -99,7 +108,7 @@ function listrTaskForChecker(
99
108
) {
100
109
return ( _ : Checker , tidx : number ) => {
101
110
const idx = gidx + tidx
102
- const title = formatLabel ( _ . label , undefined )
111
+ const title = formatLabel ( _ , undefined )
103
112
104
113
return {
105
114
title,
@@ -154,7 +163,7 @@ export async function checkPrerequistes(
154
163
task . newListr (
155
164
checkers ( args )
156
165
. filter ( _ => _ . group === Group [ group ] )
157
- . sort ( ( a , b ) => formatLabel ( a . label , undefined ) . localeCompare ( formatLabel ( b . label , undefined ) ) )
166
+ . sort ( ( a , b ) => formatLabel ( a , undefined ) . localeCompare ( formatLabel ( b , undefined ) ) )
158
167
. map ( listrTaskForChecker ( args , stdout , fixErrors , gidx * nGroups ) ) ,
159
168
options
160
169
)
0 commit comments