From 247cda035296b519802714e4228913014a052dbb Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 6 Jul 2016 19:51:21 +0200 Subject: [PATCH] Rip out exec() --- imag-todo/src/main.rs | 24 ------------------------ imag-todo/src/ui.rs | 14 -------------- 2 files changed, 38 deletions(-) diff --git a/imag-todo/src/main.rs b/imag-todo/src/main.rs index e1610dc4..31274761 100644 --- a/imag-todo/src/main.rs +++ b/imag-todo/src/main.rs @@ -46,7 +46,6 @@ fn main() { match rt.cli().subcommand_name() { Some("tw-hook") => tw_hook(&rt), - Some("exec") => exec(&rt), Some("list") => list(&rt), _ => unimplemented!(), } // 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) { let subcmd = rt.cli().subcommand_matches("list").unwrap(); let mut args = Vec::new(); diff --git a/imag-todo/src/ui.rs b/imag-todo/src/ui.rs index ae2adc07..507f4379 100644 --- a/imag-todo/src/ui.rs +++ b/imag-todo/src/ui.rs @@ -27,20 +27,6 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .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") .about("create a task") .version("0.1")