From c74335828d0157315a438053a1555701bbb8fae6 Mon Sep 17 00:00:00 2001 From: Louis Vallat Date: Sun, 31 Oct 2021 18:42:26 +0100 Subject: [PATCH] Renamed the subcommand 'albums --get' to 'get_albums' for better documentation and easier handling Signed-off-by: Louis Vallat --- src/main.rs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/main.rs b/src/main.rs index 495f734..5112d4d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,13 +46,8 @@ async fn main() -> Result<(), Box> { .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,13 +70,9 @@ async fn main() -> Result<(), Box> { 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") { - 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 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(); }