(dockerCLI command.Cli)
| 16 | } |
| 17 | |
| 18 | func newRemoveCommand(dockerCLI command.Cli) *cobra.Command { |
| 19 | var opts removeOptions |
| 20 | cmd := &cobra.Command{ |
| 21 | Use: "rm CONTEXT [CONTEXT...]", |
| 22 | Aliases: []string{"remove"}, |
| 23 | Short: "Remove one or more contexts", |
| 24 | Args: cli.RequiresMinArgs(1), |
| 25 | RunE: func(cmd *cobra.Command, args []string) error { |
| 26 | return runRemove(dockerCLI, opts, args) |
| 27 | }, |
| 28 | ValidArgsFunction: completeContextNames(dockerCLI, -1, false), |
| 29 | DisableFlagsInUseLine: true, |
| 30 | } |
| 31 | cmd.Flags().BoolVarP(&opts.force, "force", "f", false, "Force the removal of a context in use") |
| 32 | return cmd |
| 33 | } |
| 34 | |
| 35 | // runRemove removes one or more contexts. |
| 36 | func runRemove(dockerCLI command.Cli, opts removeOptions, names []string) error { |
no test coverage detected
searching dependent graphs…