From d6c4d883f8b1cb06e73a206567b4ec4e622f5658 Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Mon, 2 Jan 2023 10:35:47 -0700 Subject: [PATCH] client/login: Add --set-default --- client/src/command/login.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/command/login.rs b/client/src/command/login.rs index c04dc72..4cb9281 100644 --- a/client/src/command/login.rs +++ b/client/src/command/login.rs @@ -16,6 +16,10 @@ pub struct Login { /// Access token. token: Option, + + /// Set the server as the default. + #[clap(long)] + set_default: bool, } pub async fn run(opts: Opts) -> Result<()> { @@ -43,7 +47,7 @@ pub async fn run(opts: Opts) -> Result<()> { ); } - if config_m.servers.len() == 1 { + if sub.set_default || config_m.servers.len() == 1 { config_m.default_server = Some(sub.name.to_owned()); }