mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
grafana-cli: Upgrade to urfave/cli v2 (#22402)
* grafana-cli: Upgrade to urfave/cli v2
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user