mirror of
https://github.com/grafana/grafana.git
synced 2024-11-27 03:11:01 -06:00
eb98d9c15b
* grafana-cli: Upgrade to urfave/cli v2
34 lines
663 B
Go
34 lines
663 B
Go
package commands
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
|
|
"github.com/grafana/grafana/pkg/cmd/grafana-cli/utils"
|
|
)
|
|
|
|
var removePlugin func(pluginPath, id string) error = services.RemoveInstalledPlugin
|
|
|
|
func (cmd Command) removeCommand(c utils.CommandLine) error {
|
|
pluginPath := c.PluginDirectory()
|
|
|
|
plugin := c.Args().First()
|
|
if plugin == "" {
|
|
return errors.New("missing plugin parameter")
|
|
}
|
|
|
|
err := removePlugin(pluginPath, plugin)
|
|
|
|
if err != nil {
|
|
if strings.Contains(err.Error(), "no such file or directory") {
|
|
return fmt.Errorf("plugin does not exist")
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|