/
cmd.go
53 lines (47 loc) · 1.07 KB
/
cmd.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
53
package cmd
import (
"github.com/urfave/cli"
"x-patrol/util"
"x-patrol/web"
)
var Web = cli.Command{
Name: "web",
Usage: "Startup a web Service",
Description: "Startup a web Service",
Action: web.RunWeb,
Flags: []cli.Flag{
boolFlag("debug, d", "Debug Mode"),
stringFlag("host, H", "0.0.0.0", "web listen address"),
intFlag("port, p", 8000, "web listen port"),
},
}
var Scan = cli.Command{
Name: "scan",
Usage: "start to scan github leak info",
Description: "start to scan github leak info",
Action: util.Scan,
Flags: []cli.Flag{
stringFlag("mode, m", "github", "scan mode: github, local, all"),
intFlag("time, t", 900, "scan interval(second)"),
},
}
func stringFlag(name, value, usage string) cli.StringFlag {
return cli.StringFlag{
Name: name,
Value: value,
Usage: usage,
}
}
func boolFlag(name, usage string) cli.BoolFlag {
return cli.BoolFlag{
Name: name,
Usage: usage,
}
}
func intFlag(name string, value int, usage string) cli.IntFlag {
return cli.IntFlag{
Name: name,
Value: value,
Usage: usage,
}
}