Files
docker-cli/cli/command/plugin/disable.go
Sebastiaan van Stijn 4f7c07cfc2 update local code for updated modules
Some tests had to be skipped as there's some issues to address, and
some of the result-types cannot be mocked / stubbed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-24 10:28:54 +02:00

35 lines
855 B
Go

package plugin
import (
"fmt"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/moby/moby/client"
"github.com/spf13/cobra"
)
func newDisableCommand(dockerCLI command.Cli) *cobra.Command {
var opts client.PluginDisableOptions
cmd := &cobra.Command{
Use: "disable [OPTIONS] PLUGIN",
Short: "Disable a plugin",
Args: cli.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
name := args[0]
if _, err := dockerCLI.Client().PluginDisable(cmd.Context(), name, opts); err != nil {
return err
}
_, _ = fmt.Fprintln(dockerCLI.Out(), name)
return nil
},
ValidArgsFunction: completeNames(dockerCLI, stateEnabled),
DisableFlagsInUseLine: true,
}
flags := cmd.Flags()
flags.BoolVarP(&opts.Force, "force", "f", false, "Force the disable of an active plugin")
return cmd
}