Skip to content

Commit cb690ff

Browse files
authored
feat(cli): infer pro license when identity provider and region are specified (#1369)
1 parent 2a9e681 commit cb690ff

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

crates/q_cli/src/cli/user.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,19 @@ pub async fn login_interactive(args: LoginArgs) -> Result<()> {
238238
Some(LicenseType::Free) => AuthMethod::BuilderId,
239239
Some(LicenseType::Pro) => AuthMethod::IdentityCenter,
240240
None => {
241-
// No license specified, prompt the user to choose
242-
let options = [AuthMethod::BuilderId, AuthMethod::IdentityCenter];
243-
let i = match choose("Select login method", &options)? {
244-
Some(i) => i,
245-
None => bail!("No login method selected"),
246-
};
247-
options[i]
241+
if args.identity_provider.is_some() && args.region.is_some() {
242+
// If license is specified and --identity-provider and --region are specified,
243+
// the license is determined to be pro
244+
AuthMethod::IdentityCenter
245+
} else {
246+
// --license is not specified, prompt the user to choose
247+
let options = [AuthMethod::BuilderId, AuthMethod::IdentityCenter];
248+
let i = match choose("Select login method", &options)? {
249+
Some(i) => i,
250+
None => bail!("No login method selected"),
251+
};
252+
options[i]
253+
}
248254
},
249255
};
250256

0 commit comments

Comments
 (0)