newLogoutCommand creates a new `docker logout` command
(dockerCLI command.Cli)
| 19 | |
| 20 | // newLogoutCommand creates a new `docker logout` command |
| 21 | func newLogoutCommand(dockerCLI command.Cli) *cobra.Command { |
| 22 | cmd := &cobra.Command{ |
| 23 | Use: "logout [SERVER]", |
| 24 | Short: "Log out from a registry", |
| 25 | Long: "Log out from a registry.\nIf no server is specified, the default is defined by the daemon.", |
| 26 | Args: cli.RequiresMaxArgs(1), |
| 27 | RunE: func(cmd *cobra.Command, args []string) error { |
| 28 | var serverAddress string |
| 29 | if len(args) > 0 { |
| 30 | serverAddress = args[0] |
| 31 | } |
| 32 | return runLogout(cmd.Context(), dockerCLI, serverAddress) |
| 33 | }, |
| 34 | Annotations: map[string]string{ |
| 35 | "category-top": "9", |
| 36 | }, |
| 37 | DisableFlagsInUseLine: true, |
| 38 | // TODO (thaJeztah) add completion for registries we have authentication stored for |
| 39 | } |
| 40 | |
| 41 | return cmd |
| 42 | } |
| 43 | |
| 44 | func runLogout(ctx context.Context, dockerCLI command.Cli, serverAddress string) error { |
| 45 | maybePrintEnvAuthWarning(dockerCLI) |
nothing calls this directly
no test coverage detected
searching dependent graphs…