- fix various unhandled errors
- remove some locally defined option-types in favor of option-types
defined by the client / api
- don't use unkeyed structs in tests, and add docs for some subtests
- fix some values in tests that triggered "spellcheck" warnings
- inline vars / functions that only had a single use.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit c6f935eba5)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
33 lines
762 B
Go
33 lines
762 B
Go
package plugin
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/docker/cli/cli"
|
|
"github.com/docker/cli/cli/command"
|
|
"github.com/docker/docker/api/types"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func newDisableCommand(dockerCLI command.Cli) *cobra.Command {
|
|
var opts types.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
|
|
},
|
|
}
|
|
|
|
flags := cmd.Flags()
|
|
flags.BoolVarP(&opts.Force, "force", "f", false, "Force the disable of an active plugin")
|
|
return cmd
|
|
}
|