-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Expand file tree
/
Copy pathdisable.go
More file actions
32 lines (27 loc) · 762 Bytes
/
disable.go
File metadata and controls
32 lines (27 loc) · 762 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
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
}