Set active account
This commit is contained in:
@@ -143,6 +143,32 @@ impl Engine {
|
||||
}
|
||||
}
|
||||
|
||||
"use" | "set" => {
|
||||
if args.len() < 2 {
|
||||
return self.invalid_command_usage("account man").await;
|
||||
}
|
||||
|
||||
let new_active = args[1];
|
||||
|
||||
let mut accounts = self.accounts.lock().await;
|
||||
|
||||
if !accounts.accounts.contains_key(new_active) {
|
||||
return self
|
||||
.terminal_server
|
||||
.error("account man", &format!("Account not found ({new_active})"))
|
||||
.await;
|
||||
}
|
||||
|
||||
accounts.active = new_active.to_string();
|
||||
|
||||
self.terminal_server
|
||||
.info(
|
||||
"account man",
|
||||
&format!("Account set to {new_active} successfully!"),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
|
||||
_ => {
|
||||
return self.invalid_command_usage("account man").await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user