Skip to content

Commit 8b85435

Browse files
author
yckj0834
committed
add tags build
1 parent 52463e8 commit 8b85435

File tree

6 files changed

+85
-14
lines changed

6 files changed

+85
-14
lines changed

executors/executors.go

+2-14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// +build !gopacket
2+
13
package executors
24

35
import (
@@ -6,7 +8,6 @@ import (
68

79
"github.com/lflxp/showme/completers"
810
"github.com/lflxp/showme/executors/dashboard"
9-
"github.com/lflxp/showme/executors/gopacket"
1011
"github.com/lflxp/showme/executors/helloworld"
1112
"github.com/lflxp/showme/executors/layout"
1213
"github.com/lflxp/showme/executors/monitor"
@@ -52,19 +53,6 @@ func ParseExecutors(in string) (func(), bool) {
5253
completers.Help()
5354
}
5455
status = true
55-
} else if strings.Contains(in, "gopacket") {
56-
if strings.Contains(in, "gopacket in") {
57-
result = func() {
58-
gopacket.Run(in)
59-
}
60-
}
61-
if strings.Contains(in, "gopacket screen") {
62-
result = func() {
63-
// gopacket.Gopacket(in)
64-
gopacket.Screen(strings.Split(in, " ")[2])
65-
}
66-
}
67-
status = true
6856
} else if strings.Contains(in, "scan") {
6957
result = func() {
7058
scan.Scan(in)

executors/executorsGopacket.go

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// +build gopacket
2+
3+
package executors
4+
5+
import (
6+
"fmt"
7+
"strings"
8+
9+
"github.com/lflxp/showme/completers"
10+
"github.com/lflxp/showme/executors/dashboard"
11+
"github.com/lflxp/showme/executors/gopacket"
12+
"github.com/lflxp/showme/executors/helloworld"
13+
"github.com/lflxp/showme/executors/layout"
14+
"github.com/lflxp/showme/executors/monitor"
15+
"github.com/lflxp/showme/executors/scan"
16+
"github.com/lflxp/showme/utils"
17+
)
18+
19+
/** 解析执行命令函数
20+
@param in // command from
21+
@result func() // function
22+
@result bool // 状态 是否执行
23+
*/
24+
func ParseExecutors(in string) (func(), bool) {
25+
var result func()
26+
status := false
27+
if in == "dashboard show" {
28+
result = func() {
29+
dashboard.Run()
30+
}
31+
status = true
32+
} else if in == "dashboard helloworld" {
33+
result = func() {
34+
helloworld.Run()
35+
}
36+
status = true
37+
} else if in == "gocui active" {
38+
result = func() {
39+
layout.Run()
40+
}
41+
status = true
42+
} else if in == "dashboard" {
43+
result = func() {
44+
dashboard.Dashboard()
45+
}
46+
status = true
47+
} else if strings.Contains(in, "monitor") {
48+
result = func() {
49+
monitor.Run(in)
50+
}
51+
status = true
52+
} else if in == "help" {
53+
result = func() {
54+
completers.Help()
55+
}
56+
status = true
57+
} else if strings.Contains(in, "gopacket") {
58+
if strings.Contains(in, "gopacket in") {
59+
result = func() {
60+
gopacket.Run(in)
61+
}
62+
}
63+
if strings.Contains(in, "gopacket screen") {
64+
result = func() {
65+
// gopacket.Gopacket(in)
66+
gopacket.Screen(strings.Split(in, " ")[2])
67+
}
68+
}
69+
status = true
70+
} else if strings.Contains(in, "scan") {
71+
result = func() {
72+
scan.Scan(in)
73+
}
74+
status = true
75+
} else {
76+
fmt.Println(utils.Colorize(in, "red", "black", true, true), " not found executors")
77+
}
78+
return result, status
79+
}

executors/gopacket/gopacket.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// +build gopacket
2+
23
package gopacket
34

45
import (

executors/gopacket/init.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// +build gopacket
2+
23
package gopacket
34

45
import (

executors/gopacket/screen.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// +build gopacket
2+
23
package gopacket
34

45
import (

utils/watch.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// +build gopacket
2+
23
package utils
34

45
import (

0 commit comments

Comments
 (0)