MCPcopy Index your code
hub / github.com/docker/cli / newEnableCommand

Function newEnableCommand

cli/command/plugin/enable.go:13–35  ·  view source on GitHub ↗
(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

11)
12
13func newEnableCommand(dockerCLI command.Cli) *cobra.Command {
14 var opts client.PluginEnableOptions
15
16 cmd := &cobra.Command{
17 Use: "enable [OPTIONS] PLUGIN",
18 Short: "Enable a plugin",
19 Args: cli.ExactArgs(1),
20 RunE: func(cmd *cobra.Command, args []string) error {
21 name := args[0]
22 if err := runEnable(cmd.Context(), dockerCLI, name, opts); err != nil {
23 return err
24 }
25 _, _ = fmt.Fprintln(dockerCLI.Out(), name)
26 return nil
27 },
28 ValidArgsFunction: completeNames(dockerCLI, stateDisabled),
29 DisableFlagsInUseLine: true,
30 }
31
32 flags := cmd.Flags()
33 flags.IntVar(&opts.Timeout, "timeout", 30, "HTTP client timeout (in seconds)")
34 return cmd
35}
36
37func runEnable(ctx context.Context, dockerCli command.Cli, name string, opts client.PluginEnableOptions) error {
38 if opts.Timeout < 0 {

Callers 3

newPluginCommandFunction · 0.85
TestPluginEnableErrorsFunction · 0.85
TestPluginEnableFunction · 0.85

Calls 3

runEnableFunction · 0.85
completeNamesFunction · 0.70
OutMethod · 0.65

Tested by 2

TestPluginEnableErrorsFunction · 0.68
TestPluginEnableFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…