mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(cli): use commandline object all the way
This commit is contained in:
parent
da2b65cd7c
commit
95f3e52064
@ -49,11 +49,12 @@ func installCommand(c CommandLine) error {
|
||||
log.Infof("version: %v\n", version)
|
||||
}
|
||||
|
||||
return InstallPlugin(pluginToInstall, pluginFolder, version, c.GlobalString("repo"))
|
||||
return InstallPlugin(pluginToInstall, version, c)
|
||||
}
|
||||
|
||||
func InstallPlugin(pluginName, pluginFolder, version, repoUrl string) error {
|
||||
plugin, err := s.GetPlugin(pluginName, repoUrl)
|
||||
func InstallPlugin(pluginName, version string, c CommandLine) error {
|
||||
plugin, err := s.GetPlugin(pluginName, c.GlobalString("repo"))
|
||||
pluginFolder := c.GlobalString("path")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -85,7 +86,7 @@ func InstallPlugin(pluginName, pluginFolder, version, repoUrl string) error {
|
||||
res, _ := s.ReadPlugin(pluginFolder, pluginName)
|
||||
|
||||
for _, v := range res.Dependency.Plugins {
|
||||
InstallPlugin(v.Id, pluginFolder, "", repoUrl)
|
||||
InstallPlugin(v.Id, version, c)
|
||||
log.Infof("Installed Dependency: %v ✔\n", v.Id)
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ func upgradeAllCommand(c CommandLine) error {
|
||||
log.Infof("Upgrading %v \n", p.Id)
|
||||
|
||||
s.RemoveInstalledPlugin(pluginDir, p.Id)
|
||||
InstallPlugin(p.Id, pluginDir, "", c.GlobalString("repo"))
|
||||
InstallPlugin(p.Id, "", c)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -24,7 +24,7 @@ func upgradeCommand(c CommandLine) error {
|
||||
if localPlugin.Id == v.Id {
|
||||
if ShouldUpgrade(localPlugin.Info.Version, v) {
|
||||
s.RemoveInstalledPlugin(pluginDir, pluginName)
|
||||
return InstallPlugin(localPlugin.Id, pluginDir, "", c.GlobalString("repo"))
|
||||
return InstallPlugin(localPlugin.Id, "", c)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user