(deps commandDeps)
| 138 | } |
| 139 | |
| 140 | func newProviderAuthLoginCommand(deps commandDeps) *cobra.Command { |
| 141 | var printCommand bool |
| 142 | var noTTY bool |
| 143 | var timeout time.Duration |
| 144 | options := func() providerAuthLoginOptions { |
| 145 | return providerAuthLoginOptions{printCommand: printCommand, noTTY: noTTY, timeout: timeout} |
| 146 | } |
| 147 | cmd := &cobra.Command{ |
| 148 | Use: "login <provider>", |
| 149 | Short: "Run the provider native login command locally", |
| 150 | Args: exactOneNonBlankArg(), |
| 151 | RunE: func(cmd *cobra.Command, args []string) error { |
| 152 | return runProviderAuthLoginCommand(cmd, deps, args[0], options()) |
| 153 | }, |
| 154 | } |
| 155 | cmd.Flags(). |
| 156 | BoolVar(&printCommand, "print-command", false, "Print only the resolved provider login command") |
| 157 | cmd.Flags().BoolVar(&noTTY, "no-tty", false, "Disable TTY attachment for the login command") |
| 158 | cmd.Flags().DurationVar(&timeout, "timeout", 0, "Optional login command timeout") |
| 159 | return cmd |
| 160 | } |
| 161 | |
| 162 | type providerAuthLoginOptions struct { |
| 163 | printCommand bool |
no test coverage detected