add command parsing
This commit is contained in:
parent
d68ed91be1
commit
b9d6d83bb7
1 changed files with 44 additions and 1 deletions
|
@ -20,5 +20,48 @@ mod ui;
|
|||
use ui::build_ui;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
let name = "imag-todo";
|
||||
let version = &version!()[..];
|
||||
let about = "Interface with taskwarrior";
|
||||
let ui = build_ui(Runtime::get_default_cli_builder(name, version, about));
|
||||
let rt = {
|
||||
let rt = Runtime::new(ui);
|
||||
if rt.is_ok() {
|
||||
rt.unwrap()
|
||||
} else {
|
||||
println!("Could not set up Runtime");
|
||||
println!("{:?}", rt.unwrap_err());
|
||||
exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
let scmd = rt.cli().subcommand_name();
|
||||
match scmd {
|
||||
Some("tw-hook") => {
|
||||
let subcmd = rt.cli().subcommand_matches("tw-hook").unwrap();
|
||||
if subcmd.is_present("add") {
|
||||
println!("To be implemented");
|
||||
//
|
||||
// TODO @Kevin: import function aus task_hookrs benutzen, um
|
||||
// stdin auszulesen, und dann auf dem
|
||||
// task_hookrs::task::Task den Trait für die
|
||||
// Umwandlung aufrufen.
|
||||
//
|
||||
}
|
||||
else if subcmd.is_present("delete") {
|
||||
println!("To be implemented");
|
||||
//
|
||||
// Functionality to delete Entry in the store
|
||||
//
|
||||
}
|
||||
else {
|
||||
// Should not be possible, as one argument is required via
|
||||
// ArgGroup
|
||||
panic!("Reached unreachable Code");
|
||||
}
|
||||
},
|
||||
Some("exec") => {
|
||||
},
|
||||
_ => println!("Nothing implemented yet"),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue