From 836870f1ce9d95ab5814802f170f53eccfc772f8 Mon Sep 17 00:00:00 2001 From: daimond113 <72147841+daimond113@users.noreply.github.com> Date: Mon, 12 Aug 2024 22:31:05 +0200 Subject: [PATCH] fix: improve login command behaviour --- src/cli/commands/auth/login.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/cli/commands/auth/login.rs b/src/cli/commands/auth/login.rs index ffe729b..d40feeb 100644 --- a/src/cli/commands/auth/login.rs +++ b/src/cli/commands/auth/login.rs @@ -20,11 +20,7 @@ pub struct LoginCommand { /// The index to use. Defaults to `default`, or the configured default index if current directory doesn't have a manifest #[arg(short, long)] index: Option, - - /// Whether to not prefix the token with `Bearer ` - #[arg(short, long, conflicts_with = "token")] - no_bearer: bool, - + /// The token to use for authentication, skipping login #[arg(short, long, conflicts_with = "index")] token: Option, @@ -185,12 +181,13 @@ impl LoginCommand { } pub fn run(self, project: Project, reqwest: reqwest::blocking::Client) -> anyhow::Result<()> { + let token_given = self.token.is_some(); let token = match self.token { Some(token) => token, None => self.authenticate_device_flow(&project, &reqwest)?, }; - let token = if self.no_bearer { + let token = if token_given { println!("set token"); token } else {