diff options
author | Jesse Luehrs <doy@tozt.net> | 2018-11-10 02:42:17 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2018-11-10 02:42:17 -0500 |
commit | ef7cd5bc677c6aabf5517e74ab64eb84d4784057 (patch) | |
tree | a176623ad0a80804e1d4f6b714b202e5defa1fb0 /src/cli.rs | |
parent | 07f8d93eff3fd186b7c9bc5125e00cef16bd1a42 (diff) | |
download | lastfm-query-ef7cd5bc677c6aabf5517e74ab64eb84d4784057.tar.gz lastfm-query-ef7cd5bc677c6aabf5517e74ab64eb84d4784057.zip |
unify cli and cmd
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) -} |