forked from CrackerCat/itool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
66 lines (55 loc) · 1.17 KB
/
main.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
54
55
56
57
58
59
60
61
62
63
64
65
66
package main
import (
"os"
"github.com/gofmt/itool/cmd"
"github.com/gookit/gcli/v3"
)
var (
version = "1.0.1-beta"
)
func main() {
gcli.DefaultVerb = gcli.VerbQuiet
app := gcli.NewApp(func(app *gcli.App) {
app.Version = "v" + version
app.Desc = "itool"
app.ExitOnEnd = false
app.On(gcli.EvtAppInit, func(data ...interface{}) (stop bool) {
return false
})
})
app.On(gcli.EvtAppRunError, func(data ...interface{}) (stop bool) {
app.Println(data[1])
return true
})
app.On(gcli.EvtCmdNotFound, func(data ...interface{}) (stop bool) {
app.Println(`没有这个命令 "%s"`, data[1])
app.Println("\n使用 itool --help 查看可用的命令")
return true
})
app.On(gcli.EvtAppCmdNotFound, func(data ...interface{}) (stop bool) {
return false
})
app.On(gcli.EvtCmdRunError, func(data ...interface{}) (stop bool) {
return false
})
app.Add(
cmd.DeviceCmd,
cmd.InfoCmd,
cmd.RestartCmd,
cmd.ShutdownCmd,
cmd.SyslogCmd,
cmd.AppCmd,
cmd.InstallCmd,
cmd.UninstallCmd,
cmd.ShellCmd,
cmd.ForwardCmd,
cmd.PcapCmd,
cmd.DebugCmd,
cmd.FileCmd,
cmd.ScreenShotCmd,
cmd.FridaCmd,
cmd.ScpCmd,
cmd.Scp2Cmd,
)
os.Exit(app.Run(nil))
}