listremote_command.go 699 B

12345678910111213141516171819202122232425262728
  1. package commands
  2. import (
  3. "github.com/grafana/grafana/pkg/cmd/grafana-cli/logger"
  4. "github.com/grafana/grafana/pkg/cmd/grafana-cli/utils"
  5. )
  6. // listRemoteCommand prints out all plugins in the remote repo with latest version supported on current platform.
  7. // If there are no supported versions for plugin it is skipped.
  8. func listRemoteCommand(c utils.CommandLine) error {
  9. plugin, err := c.ApiClient().ListAllPlugins(c.RepoDirectory())
  10. if err != nil {
  11. return err
  12. }
  13. for _, plugin := range plugin.Plugins {
  14. if len(plugin.Versions) > 0 {
  15. ver := latestSupportedVersion(&plugin)
  16. if ver != nil {
  17. logger.Infof("id: %v version: %s\n", plugin.Id, ver.Version)
  18. }
  19. }
  20. }
  21. return nil
  22. }