From b50586f991c1414cb322413a9b8a73fe40a104f5 Mon Sep 17 00:00:00 2001 From: Ben Morrison Date: Wed, 4 Sep 2019 18:33:40 -0400 Subject: fixed subcommands --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 12 ++++-------- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e4cc6e1..62411da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -119,7 +119,7 @@ dependencies = [ [[package]] name = "clinte" -version = "0.4.0" +version = "0.4.1" dependencies = [ "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 3e53b9f..a722af2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "clinte" -version = "0.4.0" +version = "0.4.1" authors = ["Ben Morrison "] edition = "2018" diff --git a/src/main.rs b/src/main.rs index 35df02f..f003a5b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,12 +19,8 @@ fn main() { .author("Ben Morrison (gbmor)") .about("Command-line community notices system") .subcommand(clap::SubCommand::with_name("post").about("Post a new notice")) - .subcommand( - clap::SubCommand::with_name("update_handler").about("Update a notice you've posted"), - ) - .subcommand( - clap::SubCommand::with_name("delete_handler").about("Delete a notice you've posted"), - ) + .subcommand(clap::SubCommand::with_name("update").about("Update a notice you've posted")) + .subcommand(clap::SubCommand::with_name("delete").about("Delete a notice you've posted")) .get_matches(); let start = time::Instant::now(); @@ -41,7 +37,7 @@ fn main() { if arg_matches.subcommand_matches("post").is_some() { info!("New post..."); posts::create(&db); - } else if arg_matches.subcommand_matches("update_handler").is_some() { + } else if arg_matches.subcommand_matches("update").is_some() { let id: u32 = if let Some(val) = arg_matches.subcommand_matches("update_handler") { val.value_of("id").unwrap().parse().unwrap() } else { @@ -49,7 +45,7 @@ fn main() { }; info!("Updating post ..."); posts::update_handler(&db, id); - } else if arg_matches.subcommand_matches("delete_handler").is_some() { + } else if arg_matches.subcommand_matches("delete").is_some() { let id: u32 = if let Some(val) = arg_matches.subcommand_matches("update_handler") { val.value_of("id").unwrap().parse().unwrap() } else { -- cgit 1.4.1-2-gfad0