(dockerCLI command.Cli)
| 11 | ) |
| 12 | |
| 13 | func 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 | |
| 37 | func runEnable(ctx context.Context, dockerCli command.Cli, name string, opts client.PluginEnableOptions) error { |
| 38 | if opts.Timeout < 0 { |
searching dependent graphs…