-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathcmd_default.go
49 lines (40 loc) · 1.01 KB
/
cmd_default.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
package main
import (
"fmt"
"github.com/fatih/color"
"github.com/spf13/pflag"
)
func printHelpDefault() {
fmt.Printf(
`Usage: %s <cmd> [<opts>] [<args>]
Commands:
read read data for IPs in an mmdb file.
import import data in non-mmdb format into mmdb.
export export data from mmdb format into non-mmdb format.
diff see the difference between two mmdb files.
metadata print metadata from the mmdb file.
verify check that the mmdb file is not corrupted or invalid.
completion install or output shell auto-completion script.
Options:
General:
--nocolor
disable colored output.
--help, -h
show help.
`, progBase)
}
func cmdDefault() (err error) {
pflag.BoolVarP(&fHelp, "help", "h", false, "show help.")
pflag.BoolVar(&fNoColor, "nocolor", false, "disable colored output.")
pflag.Parse()
if fNoColor {
color.NoColor = true
}
if fHelp {
printHelpDefault()
return nil
}
// currently we do nothing by default.
printHelpDefault()
return nil
}