Skip to content

Commit 3a6a9ff

Browse files
Fix bug in passing around the origin str
1 parent f529d72 commit 3a6a9ff

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

src/cmd/login.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ pub struct Login {
1414

1515
impl Login {
1616
pub fn new(terminal: Terminal, flags: LoginSubcommand) -> Result<Self> {
17-
let backend = BackendClient::new(flags.origin(), None)?;
17+
let origin = flags.origin().as_deref();
18+
let backend = BackendClient::new(origin, None)?;
1819

1920
Ok(Self {
2021
terminal,
@@ -32,13 +33,15 @@ impl Login {
3233
let email = self
3334
.flags
3435
.email()
36+
.as_deref()
3537
.map(ToString::to_string)
3638
.unwrap_or_else(|| self.terminal.prompt_email());
3739

3840
// If no password was provided, prompt for their password.
3941
let password = self
4042
.flags
4143
.password()
44+
.as_deref()
4245
.map(ToString::to_string)
4346
.unwrap_or_else(|| self.terminal.prompt_password());
4447

src/config/login/mod.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use clap::Args;
2+
use derive_getters::Getters;
23

3-
#[derive(Args, Clone)]
4+
#[derive(Args, Getters, Clone)]
45
pub struct LoginSubcommand {
56
/// The email of the account
67
#[clap(long)]
@@ -12,19 +13,3 @@ pub struct LoginSubcommand {
1213
#[arg(long, short = 'o', default_value = Some("http://127.0.0.1:8080"))]
1314
origin: Option<String>,
1415
}
15-
16-
impl LoginSubcommand {
17-
/// Return the user's email, if provided via the CLI.
18-
pub fn email(&self) -> Option<&str> {
19-
self.email.as_deref()
20-
}
21-
22-
/// Return the user's password, if provided via the CLI.
23-
pub fn password(&self) -> Option<&str> {
24-
self.password.as_deref()
25-
}
26-
27-
pub fn origin(&self) -> Option<&str> {
28-
self.password.as_deref()
29-
}
30-
}

0 commit comments

Comments
 (0)