forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.go
48 lines (43 loc) · 1.09 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
package commands
import (
"github.com/codegangsta/cli"
"github.com/grafana/grafana-cli/pkg/log"
)
func runCommand(command func(commandLine CommandLine) error) func(context *cli.Context) {
return func(context *cli.Context) {
cmd := &contextCommandLine{context}
if err := command(cmd); err != nil {
log.Errorf("%v\n\n", err)
cmd.ShowHelp()
} else {
log.Info("Restart grafana after installing plugins . <service grafana-server restart>\n")
}
}
}
var Commands = []cli.Command{
{
Name: "install",
Usage: "installs stuff",
Action: runCommand(installCommand),
}, {
Name: "list-remote",
Usage: "list remote available plugins",
Action: runCommand(listremoteCommand),
}, {
Name: "upgrade",
Usage: "upgrades one plugin",
Action: runCommand(upgradeCommand),
}, {
Name: "upgrade-all",
Usage: "upgrades all your installed plugins",
Action: runCommand(upgradeAllCommand),
}, {
Name: "ls",
Usage: "list all installed plugins",
Action: runCommand(lsCommand),
}, {
Name: "remove",
Usage: "removes stuff",
Action: runCommand(removeCommand),
},
}