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
@@ -8,7 +8,7 @@ import (
"github.com/grafana/grafana/pkg/util/errutil"
)
func upgradeCommand(c utils.CommandLine) error {
func (cmd Command) upgradeCommand(c utils.CommandLine) error {
pluginsDir := c.PluginDirectory()
pluginName := c.Args().First()
@@ -18,18 +18,17 @@ func upgradeCommand(c utils.CommandLine) error {
return err
}
plugin, err2 := c.ApiClient().GetPlugin(pluginName, c.RepoDirectory())
plugin, err2 := cmd.Client.GetPlugin(pluginName, c.RepoDirectory())
if err2 != nil {
return err2
}
if shouldUpgrade(localPlugin.Info.Version, &plugin) {
if err := s.RemoveInstalledPlugin(pluginsDir, pluginName); err != nil {
return errutil.Wrapf(err, "Failed to remove plugin '%s'", pluginName)
return errutil.Wrapf(err, "failed to remove plugin '%s'", pluginName)
}
return InstallPlugin(pluginName, "", c)
return InstallPlugin(pluginName, "", c, cmd.Client)
}
logger.Infof("%s %s is up to date \n", color.GreenString("✔"), pluginName)