Plugins: Tidy up CLI code (#67813)
* more tidying * move some things around * more tidying * fix linter
This commit is contained in:
@@ -6,13 +6,10 @@ import (
|
||||
"github.com/fatih/color"
|
||||
|
||||
"github.com/grafana/grafana/pkg/cmd/grafana-cli/logger"
|
||||
"github.com/grafana/grafana/pkg/cmd/grafana-cli/models"
|
||||
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
|
||||
"github.com/grafana/grafana/pkg/cmd/grafana-cli/utils"
|
||||
)
|
||||
|
||||
var ls_getPlugins func(path string) []models.InstalledPlugin = services.GetLocalPlugins
|
||||
|
||||
var (
|
||||
errMissingPathFlag = errors.New("missing path flag")
|
||||
errNotDirectory = errors.New("plugin path is not a directory")
|
||||
@@ -41,7 +38,7 @@ func lsCommand(c utils.CommandLine) error {
|
||||
return err
|
||||
}
|
||||
|
||||
plugins := ls_getPlugins(pluginDir)
|
||||
plugins := services.GetLocalPlugins(pluginDir)
|
||||
|
||||
if len(plugins) > 0 {
|
||||
logger.Info("installed plugins:\n")
|
||||
@@ -50,7 +47,8 @@ func lsCommand(c utils.CommandLine) error {
|
||||
}
|
||||
|
||||
for _, plugin := range plugins {
|
||||
logger.Infof("%s %s %s\n", plugin.ID, color.YellowString("@"), plugin.Info.Version)
|
||||
logger.Infof("%s %s %s\n", plugin.Primary.JSONData.ID,
|
||||
color.YellowString("@"), plugin.Primary.JSONData.Info.Version)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user