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