From ff680702db85b3eec539b3be1931f92cbb89fe8d Mon Sep 17 00:00:00 2001 From: Marc Coquand Date: Wed, 15 May 2024 10:53:45 -0500 Subject: TODO and DONE are not showed in note view --- lib/grep.ml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/grep.ml b/lib/grep.ml index ac09f80..6ed2a98 100644 --- a/lib/grep.ml +++ b/lib/grep.ml @@ -19,13 +19,13 @@ let headline_pattern = let todo_pattern = Sys.getenv_opt "STITCH_TODO" |> Option.value ~default:"* TODO" let todo_pattern_regexp = - Sys.getenv_opt "STITCH_TODO_REGEXP" |> Option.value ~default:"^\\* TODO" + Sys.getenv_opt "STITCH_TODO_REGEXP" |> Option.value ~default:"\\* TODO" let done_pattern = Sys.getenv_opt "STITCH_DONE" |> Option.value ~default:"* DONE" let done_pattern_regexp = - Sys.getenv_opt "STITCH_DONE_REGEXP" |> Option.value ~default:"^\\* DONE" + Sys.getenv_opt "STITCH_DONE_REGEXP" |> Option.value ~default:"\\* DONE" (* Utils *) @@ -128,6 +128,9 @@ let run_print ~dir args = eval (chdir dir (call args |- read_all)) +let filter_todos_args = [ grep_cmd; todo_pattern_regexp; "--no-messages"; "-v" ] +let filter_done_args = [ grep_cmd; done_pattern_regexp; "--no-messages"; "-v" ] + let headline_args = [ "xargs"; grep_cmd; headline_pattern_regexp; "-H"; "-r"; "-n"; "--no-messages" ] @@ -138,7 +141,12 @@ let get_headlines () = eval (chdir execution_directory - (find_sort_name () |- call headline_args |- call [ "sort"; "-n"; "-r" ] |- read_all)) + (find_sort_name () + |- call headline_args + |- call filter_todos_args + |- call filter_done_args + |- call [ "sort"; "-n"; "-r" ] + |- read_all)) let get_tagged_headlines tag () = -- cgit v1.2.3