ui.rs needed a multiple(true)
main.rs - now we get the string argument of exec --command <string argument>
This commit is contained in:
parent
7dbf7e7d39
commit
0545b6d336
2 changed files with 29 additions and 12 deletions
|
@ -10,10 +10,16 @@ extern crate libimagstore;
|
||||||
extern crate libimagutil;
|
extern crate libimagutil;
|
||||||
|
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
use std::process::{Command, Stdio};
|
||||||
|
use std::io::prelude::*;
|
||||||
|
use std::io::BufReader;
|
||||||
|
use std::fs::File;
|
||||||
|
|
||||||
use libimagrt::runtime::Runtime;
|
use libimagrt::runtime::Runtime;
|
||||||
use libimagstore::store::FileLockEntry;
|
use libimagstore::store::FileLockEntry;
|
||||||
use libimagutil::trace::trace_error;
|
use libimagutil::trace::trace_error;
|
||||||
|
use std::error::Error;
|
||||||
|
use std::env;
|
||||||
|
|
||||||
mod ui;
|
mod ui;
|
||||||
|
|
||||||
|
@ -24,6 +30,7 @@ fn main() {
|
||||||
let version = &version!()[..];
|
let version = &version!()[..];
|
||||||
let about = "Interface with taskwarrior";
|
let about = "Interface with taskwarrior";
|
||||||
let ui = build_ui(Runtime::get_default_cli_builder(name, version, about));
|
let ui = build_ui(Runtime::get_default_cli_builder(name, version, about));
|
||||||
|
|
||||||
let rt = {
|
let rt = {
|
||||||
let rt = Runtime::new(ui);
|
let rt = Runtime::new(ui);
|
||||||
if rt.is_ok() {
|
if rt.is_ok() {
|
||||||
|
@ -35,6 +42,8 @@ fn main() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let scmd = rt.cli().subcommand_name();
|
let scmd = rt.cli().subcommand_name();
|
||||||
match scmd {
|
match scmd {
|
||||||
Some("tw-hook") => {
|
Some("tw-hook") => {
|
||||||
|
@ -62,16 +71,22 @@ fn main() {
|
||||||
},
|
},
|
||||||
Some("exec") => {
|
Some("exec") => {
|
||||||
let subcmd = rt.cli().subcommand_matches("exec").unwrap();
|
let subcmd = rt.cli().subcommand_matches("exec").unwrap();
|
||||||
let itr = subcmd.values_of_os("add").unwrap();
|
let mut string = String::from("");
|
||||||
if subcmd.is_present("command") {
|
//let args: Vec<_> = env::args().collect();
|
||||||
let string = subcmd.value_of("command").unwrap();
|
//println!("{:?}", args);
|
||||||
println!("{:?}", string);
|
if let Some(execString) = subcmd.values_of("command") {
|
||||||
else {
|
for e in execString {
|
||||||
panic!("Reached unreachable Code");
|
string.push_str(e);
|
||||||
|
string.push_str(" ");
|
||||||
|
}
|
||||||
|
//NOW SEND "string" to taskwarrior
|
||||||
|
|
||||||
|
} else {
|
||||||
|
println!("false");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ => println!("Nothing implemented yet"),
|
_ => println!("Nothing implemented yet"),
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,10 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
|
||||||
.long("command")
|
.long("command")
|
||||||
.short("c")
|
.short("c")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
|
.multiple(true)
|
||||||
.required(true)
|
.required(true)
|
||||||
.help("Args written in the string will be send directly to taskwarrior"))
|
.help("Args written in the string will be send directly to taskwarrior"))
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue