diff options
author | Marc Coquand <marc@mccd.space> | 2024-05-15 10:53:45 -0500 |
---|---|---|
committer | Marc Coquand <marc@mccd.space> | 2024-05-15 10:53:45 -0500 |
commit | ff680702db85b3eec539b3be1931f92cbb89fe8d (patch) | |
tree | d51fa69f41666236133d91d654ca481265662cfe /lib/grep.ml | |
parent | 47892663040f7e295cc4052438cf804b040f0389 (diff) | |
download | stitch-ff680702db85b3eec539b3be1931f92cbb89fe8d.tar.gz stitch-ff680702db85b3eec539b3be1931f92cbb89fe8d.tar.bz2 stitch-ff680702db85b3eec539b3be1931f92cbb89fe8d.zip |
TODO and DONE are not showed in note view
Diffstat (limited to 'lib/grep.ml')
-rw-r--r-- | lib/grep.ml | 14 |
1 files changed, 11 insertions, 3 deletions
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 () = |