(dockerCLI command.Cli)
| 18 | } |
| 19 | |
| 20 | func newUnlockKeyCommand(dockerCLI command.Cli) *cobra.Command { |
| 21 | opts := unlockKeyOptions{} |
| 22 | |
| 23 | cmd := &cobra.Command{ |
| 24 | Use: "unlock-key [OPTIONS]", |
| 25 | Short: "Manage the unlock key", |
| 26 | Args: cli.NoArgs, |
| 27 | RunE: func(cmd *cobra.Command, args []string) error { |
| 28 | return runUnlockKey(cmd.Context(), dockerCLI, opts) |
| 29 | }, |
| 30 | Annotations: map[string]string{ |
| 31 | "version": "1.24", |
| 32 | "swarm": "manager", |
| 33 | }, |
| 34 | ValidArgsFunction: cobra.NoFileCompletions, |
| 35 | DisableFlagsInUseLine: true, |
| 36 | } |
| 37 | |
| 38 | flags := cmd.Flags() |
| 39 | flags.BoolVar(&opts.rotate, flagRotate, false, "Rotate unlock key") |
| 40 | flags.BoolVarP(&opts.quiet, flagQuiet, "q", false, "Only display token") |
| 41 | |
| 42 | return cmd |
| 43 | } |
| 44 | |
| 45 | func runUnlockKey(ctx context.Context, dockerCLI command.Cli, opts unlockKeyOptions) error { |
| 46 | apiClient := dockerCLI.Client() |
searching dependent graphs…