From 1c8a540c365f281b9f8dee171360347f0dc897ff Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 10 Nov 2018 01:32:42 -0500 Subject: move the run function into cli --- src/cli.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/cli.rs') diff --git a/src/cli.rs b/src/cli.rs index c2cae24..4b6aa0d 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,6 +1,8 @@ +use cmd; + const _DUMMY_DEPENDENCY: &'static str = include_str!("../Cargo.toml"); -pub enum Command { +enum Command { Sync { username: String, }, @@ -10,7 +12,15 @@ pub enum Command { }, } -pub fn get_options() -> failure::Fallible { +pub fn run() -> failure::Fallible<()> { + let command = get_options()?; + match command { + Command::Sync { username } => cmd::sync::run(&username), + Command::SQL { query, tsv } => cmd::sql::run(&query, tsv), + } +} + +fn get_options() -> failure::Fallible { let matches = app_from_crate!() .subcommand( clap::SubCommand::with_name("sync") -- cgit v1.2.3-54-g00ecf