1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use structopt::StructOpt;
use crate::auth::AuthStore;
#[derive(Debug, StructOpt)]
pub struct LoginSubcommand {
pub token: Option<String>,
}
impl LoginSubcommand {
pub fn run(self) -> anyhow::Result<()> {
let token = match self.token {
Some(token) => token,
None => {
println!("Wally currently authenticates to registries with an API token.");
println!("In the future, Wally will support GitHub authentication.");
println!();
rpassword::prompt_password_stdout("Enter token: ")?
}
};
AuthStore::set_token(Some(&token))?;
Ok(())
}
}