forked from janek/mostr
1
0
Fork 0

feat: create nonexistent task on entering

This commit is contained in:
xeruf 2024-07-18 21:43:35 +03:00
parent 9d45525a9b
commit ab16b87497
1 changed files with 9 additions and 1 deletions

View File

@ -183,7 +183,15 @@ async fn repl() {
.and_then(|id| tasks.get(&id)) .and_then(|id| tasks.get(&id))
.and_then(|t| t.parent_id()); .and_then(|t| t.parent_id());
} }
let _ = EventId::parse(&input[dots..]).map(|p| position = Some(p)); let slice = &input[dots..];
if !slice.is_empty() {
position = EventId::parse(slice).ok().or_else(|| {
let task = make_task(slice, &[]);
let ret = Some(task.id);
add_task(&mut tasks, task);
ret
})
}
} }
_ => { _ => {