diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-09-04 18:33:40 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-09-04 18:33:40 -0400 |
commit | b50586f991c1414cb322413a9b8a73fe40a104f5 (patch) | |
tree | 3b316cb058d8340283a4026ef2a489cf89302a7b /src/main.rs | |
parent | 70a0c68e72e2602c89df0280f41de32441577a67 (diff) | |
download | clinte-b50586f991c1414cb322413a9b8a73fe40a104f5.tar.gz |
fixed subcommands v0.4.1
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 12 |
1 files changed, 4 insertions, 8 deletions
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 { |