grafana-cli: Upgrade to urfave/cli v2 (#22402)

* grafana-cli: Upgrade to urfave/cli v2
This commit is contained in:
Arve Knudsen
2020-02-26 12:27:31 +01:00
committed by GitHub
parent 6bc369629d
commit eb98d9c15b
84 changed files with 10503 additions and 4755 deletions

View File

@@ -3,9 +3,8 @@ package utils
import (
"os"
"github.com/codegangsta/cli"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/models"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
"github.com/urfave/cli/v2"
)
type CommandLine interface {
@@ -17,14 +16,12 @@ type CommandLine interface {
Int(name string) int
String(name string) string
StringSlice(name string) []string
GlobalString(name string) string
FlagNames() (names []string)
Generic(name string) interface{}
PluginDirectory() string
RepoDirectory() string
PluginURL() string
ApiClient() ApiClient
}
type ApiClient interface {
@@ -49,26 +46,22 @@ func (c *ContextCommandLine) Application() *cli.App {
return c.App
}
func (c *ContextCommandLine) HomePath() string { return c.GlobalString("homepath") }
func (c *ContextCommandLine) HomePath() string { return c.String("homepath") }
func (c *ContextCommandLine) ConfigFile() string { return c.GlobalString("config") }
func (c *ContextCommandLine) ConfigFile() string { return c.String("config") }
func (c *ContextCommandLine) PluginDirectory() string {
return c.GlobalString("pluginsDir")
return c.String("pluginsDir")
}
func (c *ContextCommandLine) RepoDirectory() string {
return c.GlobalString("repo")
return c.String("repo")
}
func (c *ContextCommandLine) PluginURL() string {
return c.GlobalString("pluginUrl")
return c.String("pluginUrl")
}
func (c *ContextCommandLine) OptionsString() string {
return c.GlobalString("configOverrides")
}
func (c *ContextCommandLine) ApiClient() ApiClient {
return &services.GrafanaComClient{}
return c.String("configOverrides")
}