diff --git a/README.md b/README.md index 2298ab6..b1dd77d 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ To stop time-tracking completely, simply move to the root of all tasks. ### Command Syntax -`TASK` creation syntax: `NAME: TAG1 TAG2 ...` +`TASK` creation syntax: `NAME #TAG *PRIO # TAG1 TAG2 ...` - `TASK` - create task + prefix with space if you want a task to start with a command character diff --git a/src/kinds.rs b/src/kinds.rs index 24c51c3..c0a03a6 100644 --- a/src/kinds.rs +++ b/src/kinds.rs @@ -91,11 +91,12 @@ pub(crate) fn extract_hashtags(input: &str) -> impl Iterator + '_ { .map(to_hashtag) } -/// Extracts everything after a ": " as a list of tags. +/// Extracts everything after a " # " as a list of tags +/// as well as various embedded tags. /// /// Expects sanitized input. pub(crate) fn extract_tags(input: &str) -> (&str, Vec) { - match input.split_once(": ") { + match input.split_once(" # ") { None => (input, extract_hashtags(input).collect_vec()), Some((name, tags)) => { let tags = extract_hashtags(name) @@ -139,6 +140,6 @@ pub(crate) fn is_hashtag(tag: &Tag) -> bool { #[test] fn test_extract_tags() { - assert_eq!(extract_tags("Hello from #mars with #greetings: yeah done-it"), + assert_eq!(extract_tags("Hello from #mars with #greetings # yeah done-it"), ("Hello from #mars with #greetings", ["mars", "greetings", "yeah", "done-it"].into_iter().map(to_hashtag).collect())) } \ No newline at end of file diff --git a/src/tasks.rs b/src/tasks.rs index 0852255..d8e38c1 100644 --- a/src/tasks.rs +++ b/src/tasks.rs @@ -1582,7 +1582,7 @@ mod tasks_test { fn test_bookmarks() { let mut tasks = stub_tasks(); let zero = EventId::all_zeros(); - let test = tasks.make_task("test: tag"); + let test = tasks.make_task("test # tag"); let parent = tasks.make_task("parent"); assert_eq!(tasks.visible_tasks().len(), 2); tasks.move_to(Some(parent)); @@ -1622,7 +1622,7 @@ mod tasks_test { #[test] fn test_procedures() { let mut tasks = stub_tasks(); - tasks.make_task_and_enter("proc: tags", State::Procedure); + tasks.make_task_and_enter("proc # tags", State::Procedure); assert_eq!(tasks.get_own_events_history().count(), 1); let side = tasks.submit( build_task("side", vec![tasks.make_event_tag(&tasks.get_current_task().unwrap().event, MARKER_DEPENDS)], None)); @@ -1738,7 +1738,7 @@ mod tasks_test { assert_position!(tasks, t1); tasks.search_depth = 2; assert_eq!(tasks.visible_tasks().len(), 0); - let t11 = tasks.make_task("t11: tag"); + let t11 = tasks.make_task("t11 # tag"); assert_eq!(tasks.visible_tasks().len(), 1); assert_eq!(tasks.get_task_path(Some(t11)), "t1>t11"); assert_eq!(tasks.relative_path(t11), "t11");