-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhelp.go
67 lines (58 loc) · 1.38 KB
/
help.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
package main
import (
"fmt"
"os"
"github.com/olekukonko/tablewriter"
)
func printHelp(commands []map[string]string) {
fmt.Println("=== help === ")
data := [][]string{}
for _, command := range commands {
data = append(data, []string{
command["command"],
command["option"],
command["description"],
})
}
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{
"command",
"option",
"description",
})
table.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: false})
table.SetCenterSeparator("|")
table.AppendBulk(data)
table.Render()
fmt.Println()
}
func help() {
commands := []map[string]string{
map[string]string{
"command": "kubedeploy get",
"option": "[-n namespace]",
"description": "Get Pods and Services information.",
},
map[string]string{
"command": "kubedeploy list",
"option": "-i image",
"description": "List image tags",
},
map[string]string{
"command": "kubedeploy replace",
"option": "-p pod -i newImage -n namespace",
"description": "Replace new image from old one in pod ",
},
map[string]string{
"command": "kubedeploy deploy",
"option": "-s service",
"description": "Blue-Green Deploy",
},
map[string]string{
"command": "kubedeploy help",
"option": "",
"description": "Print Usage",
},
}
printHelp(commands)
}