Renamed the subcommand 'albums --get' to 'get_albums' for better documentation and easier handling

Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
Louis Vallat 2021-10-31 18:42:26 +01:00
parent a790e2534d
commit c74335828d
No known key found for this signature in database
GPG Key ID: 0C87282F76E61283

View File

@ -46,13 +46,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
.about("Logout using the stored session cookie.")
)
.subcommand(
SubCommand::with_name("albums")
.about("Manage the albums.")
.arg(Arg::with_name("get")
.long("get")
.short("g")
.required(false)
.help("List the albums on the server."))
SubCommand::with_name("get_albums")
.about("Get the albums on the server.")
);
let matches = app.clone().get_matches();
@ -75,16 +70,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
write_to_file(login(&client, username, password).await.as_str(), session_path.to_str().unwrap());
} else if let Some(_) = matches.subcommand_matches("logout") {
logout(&client, &lychee_session_cookie).await;
} else if let Some(matches) = matches.subcommand_matches("albums") {
if matches.is_present("get") {
} else if let Some(_) = matches.subcommand_matches("get_albums") {
let a = get_albums(&client, &lychee_session_cookie).await.albums;
println!("{}", Table::new(a).to_string());
} else {
App::print_long_help(&mut app).unwrap();
}
} else {
App::print_long_help(&mut app).unwrap();
}
Ok(())
}