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.Error("\nError: ") log.Errorf("%s\n\n", err) cmd.ShowHelp() os.Exit(1) } else { log.Info("\nRestart grafana after installing plugins . <service grafana-server restart>\n\n") } } }
func getGrafanaPluginDir() string { currentOS := runtime.GOOS defaultNix := "/var/lib/grafana/plugins" if currentOS == "windows" { return "../data/plugins" } pwd, err := os.Getwd() if err != nil { log.Error("Could not get current path. using default") return defaultNix } if isDevenvironment(pwd) { return "../data/plugins" } return defaultNix }