mirror of
https://github.com/GuillemCastro/spotify-dl.git
synced 2024-11-21 18:00:26 +01:00
Password can know be passed as argument
This commit is contained in:
parent
3c97a9cb9c
commit
13a69704da
1 changed files with 3 additions and 1 deletions
|
@ -27,6 +27,8 @@ struct Opt {
|
|||
tracks: Vec<String>,
|
||||
#[structopt(short = "u", long = "username", help = "Your Spotify username")]
|
||||
username: String,
|
||||
#[structopt(short = "p", long = "password", help = "Your Spotify password")]
|
||||
password: Option<String>,
|
||||
#[structopt(short = "d", long = "destination", default_value = ".", help = "The directory where the songs will be downloaded")]
|
||||
destination: String
|
||||
}
|
||||
|
@ -85,7 +87,7 @@ fn main() {
|
|||
let mut core = Core::new().unwrap();
|
||||
|
||||
let username = opt.username;
|
||||
let password = rpassword::read_password_from_tty(Some("Password: ")).unwrap();
|
||||
let password = opt.password.unwrap_or_else(|| rpassword::read_password_from_tty(Some("Password: ")).unwrap());
|
||||
let credentials = Credentials::with_password(username, password);
|
||||
|
||||
let session = create_session(&mut core, credentials.clone());
|
||||
|
|
Loading…
Reference in a new issue