-
Notifications
You must be signed in to change notification settings - Fork 0
/
help.go
60 lines (47 loc) · 946 Bytes
/
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
package commands
import "fmt"
const helpMain = `
Type: "help <command>" for help on <command>
"help <tab>" to get a list of possible help topics
"quit" to exit
`
var helpMap = map[string]string{
"route": `
route path action
summary: add a route with given path and attach the given action
`,
"lsrt": `
lsrt -
summary: Display the list of all predefined routes
`,
"delrt": `
delrt route
summary: Remove the specified route
`,
"kvset": `
kvset name [key:value] ...
summary: Define a new key-value set
`,
"lskv": `
lskv -
summary: Display the list of all predefined key-value sets
`,
"help": `
help command
summary: Display help for the given command
`,
"quit": `
quit -
summary: Stop the server and exit the shell
`,
}
func helpCmd(args []string) {
if len(args) == 0 {
fmt.Print(helpMain)
return
}
helpText, ok := helpMap[args[0]]
if ok {
fmt.Print(helpText)
}
}