-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Expand file tree
/
Copy pathdisable.go
More file actions
34 lines (29 loc) · 855 Bytes
/
disable.go
File metadata and controls
34 lines (29 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
}