From 75a5f27843d72b9a59aec40a155a3ed4e12ded7f Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Sat, 24 Aug 2024 21:01:07 +0300 Subject: [PATCH] feat(main): allow creating multiple task at once with newlines --- README.md | 4 +++- src/main.rs | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9e307d9..9f0a14c 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,9 @@ To stop time-tracking completely, simply move to the root of all tasks. `TASK` creation syntax: `NAME: TAG1 TAG2 ...` -- `TASK` - create task (prefix with space if you want a task to start with a command character) +- `TASK` - create task + + prefix with space if you want a task to start with a command character + + copy in text with newlines to create one task per line - `.` - clear filters - `.TASK` + activate task by id diff --git a/src/main.rs b/src/main.rs index 6681892..282de66 100644 --- a/src/main.rs +++ b/src/main.rs @@ -662,6 +662,12 @@ async fn main() -> Result<()> { } }); continue; + } else if input.contains('\n') { + input.split('\n').for_each(|line| { + if !line.trim().is_empty() { + tasks.make_task(line); + } + }); } else { tasks.filter_or_create(tasks.get_position().as_ref(), &input); }