-
Notifications
You must be signed in to change notification settings - Fork 13
/
cmd_metadata.go
52 lines (43 loc) · 1.09 KB
/
cmd_metadata.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"fmt"
"github.com/ipinfo/cli/lib/complete"
"github.com/ipinfo/cli/lib/complete/predict"
"github.com/ipinfo/mmdbctl/lib"
"github.com/spf13/pflag"
)
var predictMetadataFmts = []string{"pretty", "json"}
var completionsMetadata = &complete.Command{
Flags: map[string]complete.Predictor{
"--nocolor": predict.Nothing,
"--data-types": predict.Nothing,
"-h": predict.Nothing,
"--help": predict.Nothing,
"-f": predict.Set(predictMetadataFmts),
"--format": predict.Set(predictMetadataFmts),
},
}
func printHelpMetadata() {
fmt.Printf(
`Usage: %s metadata [<opts>] <mmdb_file>
Options:
General:
--nocolor
disable colored output.
--data-types
show data type sizes within the data section.
--help, -h
show help.
Format:
-f <format>, --format <format>
the metadata output format.
can be "pretty" or "json".
default: pretty.
`, progBase)
}
func cmdMetadata() error {
f := lib.CmdMetadataFlags{}
f.Init()
pflag.Parse()
return lib.CmdMetadata(f, pflag.Args()[1:], printHelpMetadata)
}