Skip to content

Commit dd6ca31

Browse files
chore: copy infer license to new chat cli, rust cargo +nightly fmt (#1715)
1 parent a87c8f2 commit dd6ca31

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ winnow = "0.6.2"
168168
# https://github.com/seanmonstar/reqwest/blob/v0.12.12/Cargo.toml
169169
rustls = "0.23.23"
170170
rustls-native-certs = "0.8.1"
171-
webpki-roots = "0.26.8"
171+
webpki-roots = "=0.26.8"
172172

173173

174174
[workspace.lints.rust]

crates/chat-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ unicode-width = "0.2.0"
147147
url = "2.5.4"
148148
uuid = { version = "1.15.1", features = ["v4", "serde"] }
149149
walkdir = "2.5.0"
150-
webpki-roots = "0.26.8"
150+
webpki-roots = "=0.26.8"
151151
whoami = "1.6.0"
152152
winnow = "=0.6.2"
153153

crates/chat-cli/src/cli/user.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,19 @@ pub async fn login_interactive(args: LoginArgs) -> Result<()> {
227227
Some(LicenseType::Free) => AuthMethod::BuilderId,
228228
Some(LicenseType::Pro) => AuthMethod::IdentityCenter,
229229
None => {
230-
// No license specified, prompt the user to choose
231-
let options = [AuthMethod::BuilderId, AuthMethod::IdentityCenter];
232-
let i = match choose("Select login method", &options)? {
233-
Some(i) => i,
234-
None => bail!("No login method selected"),
235-
};
236-
options[i]
230+
if args.identity_provider.is_some() && args.region.is_some() {
231+
// If license is specified and --identity-provider and --region are specified,
232+
// the license is determined to be pro
233+
AuthMethod::IdentityCenter
234+
} else {
235+
// --license is not specified, prompt the user to choose
236+
let options = [AuthMethod::BuilderId, AuthMethod::IdentityCenter];
237+
let i = match choose("Select login method", &options)? {
238+
Some(i) => i,
239+
None => bail!("No login method selected"),
240+
};
241+
options[i]
242+
}
237243
},
238244
};
239245

0 commit comments

Comments
 (0)