mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
3136ffad1b
> ### Description Update `go.mod` to allow other packages to import [v2.0.0 versions](https://blog.golang.org/v2-go-modules). ### Changelog - [x] `CHANGELOG.md` is updated with user-facing content relevant to this PR. If no changelog is required, then add the `no-changelog-required` label. ### Affected components - [x] CLI https://github.com/hasura/graphql-engine-mono/pull/1584 GitOrigin-RevId: a5d17ad20289d1cd7217763f56ef3ba6552d69c4
43 lines
1.2 KiB
Go
43 lines
1.2 KiB
Go
package commands
|
|
|
|
/*
|
|
some of the code here is borrowed from the krew codebse (kubernetes)
|
|
and the copyright belongs to the respective authors.
|
|
|
|
source: https://github.com/kubernetes-sigs/krew/blob/master/cmd/krew/cmd/uninstall.go
|
|
*/
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/hasura/graphql-engine/cli/v2"
|
|
"github.com/pkg/errors"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func newPluginsUnInstallCmd(ec *cli.ExecutionContext) *cobra.Command {
|
|
pluginsUnInstallCmd := &cobra.Command{
|
|
Use: "uninstall [plugin-name]",
|
|
Short: "Uninstall a plugin",
|
|
Example: ` # Uninstall a plugin
|
|
hasura plugins uninstall [plugin-name]`,
|
|
SilenceUsage: true,
|
|
Args: cobra.ExactArgs(1),
|
|
PreRunE: func(cmd *cobra.Command, args []string) error {
|
|
return ec.Prepare()
|
|
},
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
pluginName := args[0]
|
|
ec.Spin(fmt.Sprintf("Uninstalling plugin %q", pluginName))
|
|
defer ec.Spinner.Stop()
|
|
if err := ec.PluginsConfig.Uninstall(pluginName); err != nil {
|
|
return errors.Wrapf(err, "failed to uninstall plugin %s", pluginName)
|
|
}
|
|
ec.Spinner.Stop()
|
|
ec.Logger.WithField("name", pluginName).Infoln("plugin uninstalled")
|
|
return nil
|
|
},
|
|
}
|
|
return pluginsUnInstallCmd
|
|
}
|