client/login: Add --set-default

This commit is contained in:
Zhaofeng Li 2023-01-02 10:35:47 -07:00
parent 425a757ad9
commit d6c4d883f8

View file

@ -16,6 +16,10 @@ pub struct Login {
/// Access token.
token: Option<String>,
/// 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());
}