The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/pkg/cmd/grafana-cli/commands/listversions_command.go

37 lines
751 B

package commands
import (
"errors"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/logger"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
"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 listVersionsCommand(c utils.CommandLine) error {
if err := validateVersionInput(c); err != nil {
return err
}
pluginToList := c.Args().First()
plugin, err := services.GetPluginInfoFromRepo(pluginToList, c.String("repo"))
if err != nil {
return err
}
for _, i := range plugin.Versions {
logger.Infof("%v\n", i.Version)
}
return nil
}