add task rm
This commit is contained in:
parent
78452bdb15
commit
91b86000ef
3 changed files with 14 additions and 0 deletions
|
@ -259,6 +259,10 @@ impl VikunjaAPI {
|
||||||
serde_json::from_str(&resp).unwrap()
|
serde_json::from_str(&resp).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn delete_task(&self, id: isize) {
|
||||||
|
self.delete_request(&format!("/tasks/{id}"));
|
||||||
|
}
|
||||||
|
|
||||||
pub fn new_task(&self, title: &str, project: &ProjectID) -> Task {
|
pub fn new_task(&self, title: &str, project: &ProjectID) -> Task {
|
||||||
let id = project.0;
|
let id = project.0;
|
||||||
|
|
||||||
|
|
|
@ -106,5 +106,11 @@ pub fn get_args() -> clap::ArgMatches {
|
||||||
.about("Mark task as done")
|
.about("Mark task as done")
|
||||||
.arg(arg!([task_id] "Task ID").required(true)),
|
.arg(arg!([task_id] "Task ID").required(true)),
|
||||||
)
|
)
|
||||||
|
.subcommand(
|
||||||
|
command!()
|
||||||
|
.name("rm")
|
||||||
|
.about("Remove task")
|
||||||
|
.arg(arg!([task_id] "Task ID").required(true)),
|
||||||
|
)
|
||||||
.get_matches()
|
.get_matches()
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,10 @@ fn main() {
|
||||||
ui::project::list_projects(&api);
|
ui::project::list_projects(&api);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Some(("rm", rm_args)) => {
|
||||||
|
let task_id: &String = rm_args.get_one("task_id").unwrap();
|
||||||
|
api.delete_task(task_id.parse().unwrap());
|
||||||
|
}
|
||||||
Some(("assign", assign_arg)) => {
|
Some(("assign", assign_arg)) => {
|
||||||
let user: &String = assign_arg.get_one("user").unwrap();
|
let user: &String = assign_arg.get_one("user").unwrap();
|
||||||
let task_id: &String = assign_arg.get_one("task_id").unwrap();
|
let task_id: &String = assign_arg.get_one("task_id").unwrap();
|
||||||
|
|
Loading…
Reference in a new issue