2016-02-15 14:09:34 +01:00
|
|
|
package commands
|
|
|
|
|
|
|
|
|
|
import (
|
2016-06-03 12:19:04 +02:00
|
|
|
"github.com/grafana/grafana/pkg/cmd/grafana-cli/logger"
|
2019-05-27 10:47:21 +02:00
|
|
|
"github.com/grafana/grafana/pkg/cmd/grafana-cli/utils"
|
2016-02-15 14:09:34 +01:00
|
|
|
)
|
|
|
|
|
|
2019-07-29 10:44:58 +02:00
|
|
|
// listRemoteCommand prints out all plugins in the remote repo with latest version supported on current platform.
|
|
|
|
|
// If there are no supported versions for plugin it is skipped.
|
2020-02-26 12:27:31 +01:00
|
|
|
func (cmd Command) listRemoteCommand(c utils.CommandLine) error {
|
2021-04-26 16:13:40 +02:00
|
|
|
plugin, err := cmd.Client.ListAllPlugins(c.PluginRepoURL())
|
2016-02-15 14:09:34 +01:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-26 08:46:08 +02:00
|
|
|
for _, p := range plugin.Plugins {
|
|
|
|
|
plugin := p
|
2019-07-29 10:44:58 +02:00
|
|
|
if len(plugin.Versions) > 0 {
|
|
|
|
|
ver := latestSupportedVersion(&plugin)
|
|
|
|
|
if ver != nil {
|
2020-11-17 17:09:14 +01:00
|
|
|
logger.Infof("id: %v version: %s\n", plugin.ID, ver.Version)
|
2019-07-29 10:44:58 +02:00
|
|
|
}
|
2016-03-01 10:55:59 +01:00
|
|
|
}
|
2016-02-15 14:09:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|