2016-02-15 07:09:34 -06:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
2016-06-03 05:19:04 -05:00
|
|
|
"github.com/grafana/grafana/pkg/cmd/grafana-cli/logger"
|
2019-05-27 03:47:21 -05:00
|
|
|
"github.com/grafana/grafana/pkg/cmd/grafana-cli/utils"
|
2016-02-15 07:09:34 -06:00
|
|
|
)
|
|
|
|
|
2019-07-29 03:44:58 -05: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 05:27:31 -06:00
|
|
|
func (cmd Command) listRemoteCommand(c utils.CommandLine) error {
|
2021-04-26 09:13:40 -05:00
|
|
|
plugin, err := cmd.Client.ListAllPlugins(c.PluginRepoURL())
|
2016-02-15 07:09:34 -06:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-06-26 01:46:08 -05:00
|
|
|
for _, p := range plugin.Plugins {
|
|
|
|
plugin := p
|
2019-07-29 03:44:58 -05:00
|
|
|
if len(plugin.Versions) > 0 {
|
|
|
|
ver := latestSupportedVersion(&plugin)
|
|
|
|
if ver != nil {
|
2020-11-17 10:09:14 -06:00
|
|
|
logger.Infof("id: %v version: %s\n", plugin.ID, ver.Version)
|
2019-07-29 03:44:58 -05:00
|
|
|
}
|
2016-03-01 03:55:59 -06:00
|
|
|
}
|
2016-02-15 07:09:34 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|