@@ -13,54 +13,54 @@ import (
13
13
"github.com/mozilla-ai/mcpd/v2/internal/runtime"
14
14
)
15
15
16
- var _ output.Printer [packages.Server ] = (* PackagePrinter )(nil )
16
+ var _ output.Printer [packages.Server ] = (* ServerPrinter )(nil )
17
17
18
- func DefaultPackageHeader () output.WriteFunc [packages.Server ] {
18
+ func DefaultServerHeader () output.WriteFunc [packages.Server ] {
19
19
return nil
20
20
}
21
21
22
- func DefaultPackageFooter () output.WriteFunc [packages.Server ] {
22
+ func DefaultServerFooter () output.WriteFunc [packages.Server ] {
23
23
return func (w io.Writer , _ int ) {
24
24
_ , _ = fmt .Fprintln (w , "" )
25
25
_ , _ = fmt .Fprintln (w , "────────────────────────────────────────────" )
26
26
_ , _ = fmt .Fprintln (w , "" )
27
27
}
28
28
}
29
29
30
- type PackagePrinter struct {
30
+ type ServerPrinter struct {
31
31
headerFunc output.WriteFunc [packages.Server ]
32
32
footerFunc output.WriteFunc [packages.Server ]
33
33
}
34
34
35
- func NewPackagePrinter () * PackagePrinter {
36
- return & PackagePrinter {
37
- headerFunc : DefaultPackageHeader (),
38
- footerFunc : DefaultPackageFooter (),
35
+ func NewServerPrinter () * ServerPrinter {
36
+ return & ServerPrinter {
37
+ headerFunc : DefaultServerHeader (),
38
+ footerFunc : DefaultServerFooter (),
39
39
}
40
40
}
41
41
42
- func (p * PackagePrinter ) Header (w io.Writer , count int ) {
42
+ func (p * ServerPrinter ) Header (w io.Writer , count int ) {
43
43
if p .headerFunc != nil {
44
44
p .headerFunc (w , count )
45
45
}
46
46
}
47
47
48
- func (p * PackagePrinter ) SetHeader (fn output.WriteFunc [packages.Server ]) {
48
+ func (p * ServerPrinter ) SetHeader (fn output.WriteFunc [packages.Server ]) {
49
49
p .headerFunc = fn
50
50
}
51
51
52
- func (p * PackagePrinter ) Footer (w io.Writer , count int ) {
52
+ func (p * ServerPrinter ) Footer (w io.Writer , count int ) {
53
53
if p .footerFunc != nil {
54
54
p .footerFunc (w , count )
55
55
}
56
56
}
57
57
58
- func (p * PackagePrinter ) SetFooter (fn output.WriteFunc [packages.Server ]) {
58
+ func (p * ServerPrinter ) SetFooter (fn output.WriteFunc [packages.Server ]) {
59
59
p .footerFunc = fn
60
60
}
61
61
62
- // Item outputs a single package entry.
63
- func (p * PackagePrinter ) Item (w io.Writer , pkg packages.Server ) error {
62
+ // Item outputs a single server entry.
63
+ func (p * ServerPrinter ) Item (w io.Writer , pkg packages.Server ) error {
64
64
parts := []string {
65
65
fmt .Sprintf (" 🆔 %s" , pkg .ID ),
66
66
}
@@ -130,7 +130,7 @@ func padRight(s string, width int) string {
130
130
return s + strings .Repeat (" " , width - len (s ))
131
131
}
132
132
133
- func (p * PackagePrinter ) printRuntimes (w io.Writer , pkg packages.Server ) {
133
+ func (p * ServerPrinter ) printRuntimes (w io.Writer , pkg packages.Server ) {
134
134
if len (pkg .Installations ) == 0 {
135
135
return
136
136
}
@@ -167,7 +167,7 @@ func (p *PackagePrinter) printRuntimes(w io.Writer, pkg packages.Server) {
167
167
}
168
168
}
169
169
170
- func (p * PackagePrinter ) printTools (w io.Writer , pkg packages.Server ) {
170
+ func (p * ServerPrinter ) printTools (w io.Writer , pkg packages.Server ) {
171
171
slices .SortFunc (pkg .Tools , func (a , b packages.Tool ) int {
172
172
return cmp .Compare (strings .ToLower (a .Name ), strings .ToLower (b .Name ))
173
173
})
@@ -178,7 +178,7 @@ func (p *PackagePrinter) printTools(w io.Writer, pkg packages.Server) {
178
178
}
179
179
}
180
180
181
- func (p * PackagePrinter ) printEnvVars (w io.Writer , pkg packages.Server ) {
181
+ func (p * ServerPrinter ) printEnvVars (w io.Writer , pkg packages.Server ) {
182
182
envs := pkg .Arguments .FilterBy (packages .EnvVar ).Ordered ()
183
183
if len (envs ) == 0 {
184
184
return
@@ -190,7 +190,7 @@ func (p *PackagePrinter) printEnvVars(w io.Writer, pkg packages.Server) {
190
190
}
191
191
}
192
192
193
- func (p * PackagePrinter ) printRequiredEnvs (w io.Writer , pkg packages.Server ) {
193
+ func (p * ServerPrinter ) printRequiredEnvs (w io.Writer , pkg packages.Server ) {
194
194
envs := pkg .Arguments .FilterBy (packages .EnvVar , packages .Required ).Names ()
195
195
if len (envs ) == 0 {
196
196
return
@@ -204,7 +204,7 @@ func (p *PackagePrinter) printRequiredEnvs(w io.Writer, pkg packages.Server) {
204
204
}
205
205
}
206
206
207
- func (p * PackagePrinter ) printPositionalArgs (w io.Writer , pkg packages.Server ) {
207
+ func (p * ServerPrinter ) printPositionalArgs (w io.Writer , pkg packages.Server ) {
208
208
args := pkg .Arguments .FilterBy (packages .PositionalArgument ).Ordered ()
209
209
if len (args ) == 0 {
210
210
return
@@ -216,7 +216,7 @@ func (p *PackagePrinter) printPositionalArgs(w io.Writer, pkg packages.Server) {
216
216
}
217
217
}
218
218
219
- func (p * PackagePrinter ) printValueFlags (w io.Writer , pkg packages.Server ) {
219
+ func (p * ServerPrinter ) printValueFlags (w io.Writer , pkg packages.Server ) {
220
220
args := pkg .Arguments .FilterBy (packages .ValueArgument ).Ordered ()
221
221
if len (args ) == 0 {
222
222
return
@@ -228,7 +228,7 @@ func (p *PackagePrinter) printValueFlags(w io.Writer, pkg packages.Server) {
228
228
}
229
229
}
230
230
231
- func (p * PackagePrinter ) printBoolFlags (w io.Writer , pkg packages.Server ) {
231
+ func (p * ServerPrinter ) printBoolFlags (w io.Writer , pkg packages.Server ) {
232
232
args := pkg .Arguments .FilterBy (packages .BoolArgument ).Ordered ()
233
233
if len (args ) == 0 {
234
234
return
@@ -240,7 +240,7 @@ func (p *PackagePrinter) printBoolFlags(w io.Writer, pkg packages.Server) {
240
240
}
241
241
}
242
242
243
- func (p * PackagePrinter ) printRequiredArgs (w io.Writer , pkg packages.Server ) {
243
+ func (p * ServerPrinter ) printRequiredArgs (w io.Writer , pkg packages.Server ) {
244
244
args := pkg .Arguments .FilterBy (packages .Argument , packages .Required ).Ordered ()
245
245
if len (args ) == 0 {
246
246
return
0 commit comments