Move functionality to own functions

This commit is contained in:
Matthias Beyer 2016-07-06 19:38:00 +02:00
parent 29c4ed853c
commit fadeae5214

View file

@ -46,7 +46,14 @@ fn main() {
let scmd = rt.cli().subcommand_name();
match scmd {
Some("tw-hook") => {
Some("tw-hook") => tw_hook(&rt),
Some("exec") => exec(&rt),
Some("list") => list(&rt),
_ => unimplemented!(),
} // end match scmd
} // end main
fn tw_hook(rt: &Runtime) {
let subcmd = rt.cli().subcommand_matches("tw-hook").unwrap();
if subcmd.is_present("add") {
let stdin = stdin();
@ -134,8 +141,9 @@ fn main() {
// ArgGroup
unreachable!();
}
},
Some("exec") => {
}
fn exec(rt: &Runtime) {
let subcmd = rt.cli().subcommand_matches("exec").unwrap();
let mut args = Vec::new();
if let Some(exec_string) = subcmd.values_of("command") {
@ -156,8 +164,9 @@ fn main() {
} else {
panic!("faild to execute: You need to exec --command");
}
}
Some("list") => {
}
fn list(rt: &Runtime) {
let subcmd = rt.cli().subcommand_matches("list").unwrap();
let mut args = Vec::new();
let verbose = subcmd.is_present("verbose");
@ -215,8 +224,5 @@ fn main() {
}
} // end match task
} // end for
}
_ => unimplemented!(),
} // end match scmd
} // end main
}