grafana/pkg/cmd/grafana-cli/commands/remove_command.go
Will Browne fd28c8490f
Plugins: Tidy up CLI code (#67723)
* remove dead code and use pkg/plugins for uninstall process

* fix linter

* remove unnecessary cruft
2023-05-04 10:52:09 +02:00

30 lines
531 B
Go

package commands
import (
"context"
"errors"
"fmt"
"strings"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/utils"
)
func removeCommand(c utils.CommandLine) error {
pluginID := c.Args().First()
if pluginID == "" {
return errors.New("missing plugin parameter")
}
err := uninstallPlugin(context.Background(), pluginID, c)
if err != nil {
if strings.Contains(err.Error(), "no such file or directory") {
return fmt.Errorf("plugin does not exist")
}
return err
} else {
logRestartNotice()
}
return nil
}