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:
parent
a790e2534d
commit
c74335828d
19
src/main.rs
19
src/main.rs
@ -46,13 +46,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
|||||||
.about("Logout using the stored session cookie.")
|
.about("Logout using the stored session cookie.")
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("albums")
|
SubCommand::with_name("get_albums")
|
||||||
.about("Manage the albums.")
|
.about("Get the albums on the server.")
|
||||||
.arg(Arg::with_name("get")
|
|
||||||
.long("get")
|
|
||||||
.short("g")
|
|
||||||
.required(false)
|
|
||||||
.help("List the albums on the server."))
|
|
||||||
);
|
);
|
||||||
let matches = app.clone().get_matches();
|
let matches = app.clone().get_matches();
|
||||||
|
|
||||||
@ -75,13 +70,9 @@ 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());
|
write_to_file(login(&client, username, password).await.as_str(), session_path.to_str().unwrap());
|
||||||
} else if let Some(_) = matches.subcommand_matches("logout") {
|
} else if let Some(_) = matches.subcommand_matches("logout") {
|
||||||
logout(&client, &lychee_session_cookie).await;
|
logout(&client, &lychee_session_cookie).await;
|
||||||
} else if let Some(matches) = matches.subcommand_matches("albums") {
|
} else if let Some(_) = matches.subcommand_matches("get_albums") {
|
||||||
if matches.is_present("get") {
|
let a = get_albums(&client, &lychee_session_cookie).await.albums;
|
||||||
let a = get_albums(&client, &lychee_session_cookie).await.albums;
|
println!("{}", Table::new(a).to_string());
|
||||||
println!("{}", Table::new(a).to_string());
|
|
||||||
} else {
|
|
||||||
App::print_long_help(&mut app).unwrap();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
App::print_long_help(&mut app).unwrap();
|
App::print_long_help(&mut app).unwrap();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user