mirror of
https://github.com/grafana/grafana.git
synced 2024-11-27 03:11:01 -06:00
eb98d9c15b
* grafana-cli: Upgrade to urfave/cli v2
37 lines
696 B
Go
37 lines
696 B
Go
package commands
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/grafana/grafana/pkg/cmd/grafana-cli/logger"
|
|
"github.com/grafana/grafana/pkg/cmd/grafana-cli/utils"
|
|
)
|
|
|
|
func validateVersionInput(c utils.CommandLine) error {
|
|
arg := c.Args().First()
|
|
if arg == "" {
|
|
return errors.New("please specify plugin to list versions for")
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (cmd Command) listVersionsCommand(c utils.CommandLine) error {
|
|
if err := validateVersionInput(c); err != nil {
|
|
return err
|
|
}
|
|
|
|
pluginToList := c.Args().First()
|
|
|
|
plugin, err := cmd.Client.GetPlugin(pluginToList, c.String("repo"))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, i := range plugin.Versions {
|
|
logger.Infof("%v\n", i.Version)
|
|
}
|
|
|
|
return nil
|
|
}
|