diff options
Diffstat (limited to 'src/cli.rs')
-rw-r--r-- | src/cli.rs | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/cli.rs b/src/cli.rs deleted file mode 100644 index b5ac878..0000000 --- a/src/cli.rs +++ /dev/null @@ -1,28 +0,0 @@ -use cmd; - -const _DUMMY_DEPENDENCY: &'static str = include_str!("../Cargo.toml"); - -pub trait Command { - fn run(&self) -> failure::Fallible<()>; -} - -pub fn run() -> failure::Fallible<()> { - get_command()?.run() -} - -fn get_command() -> failure::Fallible<Box<Command>> { - let matches = app_from_crate!() - .subcommand(cmd::sync::subcommand()) - .subcommand(cmd::sql::subcommand()) - .get_matches(); - - let command: Box<Command> = match matches.subcommand() { - ("sync", Some(matches)) => Box::new(cmd::sync::Command::new(matches)), - ("sql", Some(matches)) => Box::new(cmd::sql::Command::new(matches)), - - (name, Some(_)) => bail!("unknown subcommand: {}", name), - (_, None) => bail!("no subcommand given"), - }; - - Ok(command) -} |