-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manual.go
175 lines (156 loc) · 4.15 KB
/
manual.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
package cmd
import (
"fmt"
"airdb.io/airdb/adb/internal/adblib"
"github.com/spf13/cobra"
)
var manCommand = &cobra.Command{
Use: "man",
Short: "man command like linux",
Long: "display manual pages",
Example: adblib.MysqlDoc,
}
var gitInitCommand = &cobra.Command{
Use: "git",
Short: "git operation",
Long: "git operation",
Aliases: []string{"github", "gh"},
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(adblib.GithubDoc)
},
}
var dockerInitCommand = &cobra.Command{
Use: "docker",
Short: "docker operation",
Long: "docker operation",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("docker exec -it -e COLUMNS=`tput cols` -e LINES=`tput lines` -it airdb/go bash")
fmt.Println("docker exec -it -e COLUMNS=$(tput cols) -e LINES=$(tput lines) airdb/go bash")
},
}
var cloudInitCommand = &cobra.Command{
Use: "cloud",
Short: "cloud operation",
Long: "cloud operation",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("brew install aliyun-cli")
fmt.Println("https://github.com/aliyun/aliyun-cli")
},
}
var brewInitCommand = &cobra.Command{
Use: "brew",
Short: "brew operation",
Long: "brew operation",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(adblib.BrewDoc)
},
}
var vimInitCommand = &cobra.Command{
Use: "vim",
Short: "vim configuration",
Long: "vim configuration",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("VIM Common Plugins:")
fmt.Println("")
fmt.Printf("\tgit clone %s %s\n",
"http://github.com/fatih/vim-go.git",
"~/.vim/pack/plugins/start/vim-go",
)
},
}
var osinitCommand = &cobra.Command{
Use: "osinit",
Short: "init linux os",
Long: "init linux os",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("User-Data for Cloud Server(EC2/CVM/ECS)")
fmt.Println("")
fmt.Println("\tcurl https://init.airdb.host/osinit/ubuntu_init.sh | bash -")
},
}
var kubeCommand = &cobra.Command{
Use: "kube",
Short: "kubeneters command",
Long: "kubeneters command",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("kubeneters commands)")
fmt.Println("")
fmt.Println("\tingress")
fmt.Println("\tkubectl describe ingress")
fmt.Println("\tkubectl get ingress -o yaml")
fmt.Println("")
},
}
var helmCommand = &cobra.Command{
Use: "helm",
Short: "helm command",
Long: "helm command",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(adblib.HelmDoc)
},
}
var terraformCommand = &cobra.Command{
Use: "terraform",
Short: "terraform command",
Long: "terraform command",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(adblib.TerraformDoc)
},
}
var opensslCommand = &cobra.Command{
Use: "openssl",
Short: "openssl command",
Long: "openssl command",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(adblib.OpenSSLDoc)
},
}
var tcpdumpCommand = &cobra.Command{
Use: "tcpdump",
Short: "tcpdump command",
Long: "tcpdump command",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(adblib.TcpdumpDoc)
},
}
var toolsCommand = &cobra.Command{
Use: "tools",
Short: "tools command",
Long: "tools command",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(adblib.ToolsDoc)
},
}
var perfCommand = &cobra.Command{
Use: "perf",
Short: "application performance",
Long: "application performance",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(adblib.PerformanceDoc)
},
}
var s3Command = &cobra.Command{
Use: "s3",
Short: "s3 tools",
Long: "s3 tools",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(adblib.S3Doc)
},
}
func initManCommand() {
rootCmd.AddCommand(manCommand)
manCommand.AddCommand(gitInitCommand)
manCommand.AddCommand(dockerInitCommand)
manCommand.AddCommand(cloudInitCommand)
manCommand.AddCommand(brewInitCommand)
manCommand.AddCommand(vimInitCommand)
manCommand.AddCommand(osinitCommand)
manCommand.AddCommand(kubeCommand)
manCommand.AddCommand(helmCommand)
manCommand.AddCommand(terraformCommand)
manCommand.AddCommand(opensslCommand)
manCommand.AddCommand(toolsCommand)
manCommand.AddCommand(tcpdumpCommand)
manCommand.AddCommand(perfCommand)
manCommand.AddCommand(s3Command)
}