-
Notifications
You must be signed in to change notification settings - Fork 1
/
commands.go
65 lines (61 loc) · 1.24 KB
/
commands.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
package main
import (
"os"
"github.com/mitchellh/cli"
"github.com/spiritloose/consulkv/command"
)
// Commands is the mapping of all the available consulkv commands.
var Commands map[string]cli.CommandFactory
func init() {
ui := &cli.BasicUi{
Reader: os.Stdin,
Writer: os.Stdout,
ErrorWriter: os.Stderr,
}
Commands = map[string]cli.CommandFactory{
"list": func() (cli.Command, error) {
return &command.ListCommand{
UI: ui,
}, nil
},
"cat": func() (cli.Command, error) {
return &command.CatCommand{
UI: ui,
Output: os.Stdout,
}, nil
},
"put": func() (cli.Command, error) {
return &command.PutCommand{
UI: ui,
Input: os.Stdin,
}, nil
},
"edit": func() (cli.Command, error) {
return &command.EditCommand{
UI: ui,
}, nil
},
"delete": func() (cli.Command, error) {
return &command.DeleteCommand{
UI: ui,
}, nil
},
"flags": func() (cli.Command, error) {
return &command.FlagsCommand{
UI: ui,
}, nil
},
"dump": func() (cli.Command, error) {
return &command.DumpCommand{
UI: ui,
Output: os.Stdout,
}, nil
},
"load": func() (cli.Command, error) {
return &command.LoadCommand{
UI: ui,
Input: os.Stdin,
}, nil
},
}
}