Rip out exec()

This commit is contained in:
Matthias Beyer 2016-07-06 19:51:21 +02:00
parent aef80874da
commit 247cda0352
2 changed files with 0 additions and 38 deletions

View file

@ -46,7 +46,6 @@ fn main() {
match rt.cli().subcommand_name() { match rt.cli().subcommand_name() {
Some("tw-hook") => tw_hook(&rt), Some("tw-hook") => tw_hook(&rt),
Some("exec") => exec(&rt),
Some("list") => list(&rt), Some("list") => list(&rt),
_ => unimplemented!(), _ => unimplemented!(),
} // end match scmd } // end match scmd
@ -136,29 +135,6 @@ fn tw_hook(rt: &Runtime) {
} }
} }
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") {
for e in exec_string {
args.push(e);
}
let tw_process = Command::new("task").stdin(Stdio::null()).args(&args).spawn().unwrap_or_else(|e| {
panic!("failed to execute taskwarrior: {}", e);
});
let output = tw_process.wait_with_output().unwrap_or_else(|e| {
panic!("failed to unwrap output: {}", e);
});
let outstring = String::from_utf8(output.stdout).unwrap_or_else(|e| {
panic!("failed to ececute: {}", e);
});
println!("{}", outstring);
} else {
panic!("faild to execute: You need to exec --command");
}
}
fn list(rt: &Runtime) { fn list(rt: &Runtime) {
let subcmd = rt.cli().subcommand_matches("list").unwrap(); let subcmd = rt.cli().subcommand_matches("list").unwrap();
let mut args = Vec::new(); let mut args = Vec::new();

View file

@ -27,20 +27,6 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.required(true)) .required(true))
) )
.subcommand(SubCommand::with_name("exec")
.about("Send a command to taskwarrior")
.version("0.1")
.arg(Arg::with_name("command")
.long("command")
.short("c")
.takes_value(true)
.multiple(true)
.required(true)
.help("Args written in the string will be send directly to taskwarrior")
)
)
.subcommand(SubCommand::with_name("add") .subcommand(SubCommand::with_name("add")
.about("create a task") .about("create a task")
.version("0.1") .version("0.1")