@@ -12,9 +12,9 @@ import (
12
12
)
13
13
14
14
type MasterQueryOptions struct {
15
- Region string `long:"region" short:"r" default:"USW" description:"Region code to get results for. One of USE, USW, SA, EU, AS, AU, ME, AF, OTHER. "`
15
+ Region string `long:"region" short:"r" default:"USW" description:"Region code to get results for. See --list-regions "`
16
16
Async bool `long:"async" short:"a" default:"true" long:"async" description:"Allow async sub-querying of Source Servers to get info."`
17
- Fields string `long:"fields" default:"ip=21,name" description:"The fields to be included. Optionally includes the min-length space. See --showfields " `
17
+ Fields string `long:"fields" default:"ip=21,name" description:"The fields to be included. Optionally includes the min-length space. See --list-fields " `
18
18
// TODO(hunter): Add this
19
19
ShowFields bool `long:"show-fields" default:"false" description:"Print details on each available field."`
20
20
// TODO(hunter): Add this
@@ -30,7 +30,8 @@ type MasterQueryOptions struct {
30
30
// TODO(hunter): Add this
31
31
Filters map [string ]string `long:"filter" short:"f" description:"Filters to use. See --list-filters"`
32
32
// TODO(hunter): Add this
33
- ListFilters bool `long:"list-filters" default:"false" description:"List known filters."`
33
+ ListFilters bool `long:"list-filters" default:"false" description:"List known filters." group:"Lists"`
34
+ ListRegions bool `long:"list-regions" default:"false" description:"List Regions." group:"Lists"`
34
35
}
35
36
36
37
var masterOptions MasterQueryOptions
@@ -48,11 +49,12 @@ type SvResponse struct {
48
49
info goseq.ServerInfo
49
50
}
50
51
52
+ type infoPrinter func ()
53
+
51
54
func masterctx () {
52
55
log .SetFlags (0 )
53
56
54
- if masterOptions .ListFilters {
55
- printKnownFiltersInfo ()
57
+ if printInfo () {
56
58
return
57
59
}
58
60
@@ -267,3 +269,24 @@ type ErrorCount struct {
267
269
err error
268
270
count int
269
271
}
272
+
273
+ func printInfo () (done bool ) {
274
+ done = false
275
+
276
+ infos := []struct {
277
+ f infoPrinter
278
+ enabled bool
279
+ }{
280
+ {printKnownFiltersInfo , masterOptions .ListFilters },
281
+ {printRegionInfo , masterOptions .ListRegions },
282
+ }
283
+
284
+ for _ , info := range infos {
285
+ if info .enabled {
286
+ info .f ()
287
+ done = true
288
+ }
289
+ }
290
+
291
+ return
292
+ }
0 commit comments