aboutsummaryrefslogtreecommitdiff
path: root/lib/grep.ml
diff options
context:
space:
mode:
authorMarc Coquand <marc@mccd.space>2024-05-15 14:05:03 -0500
committerMarc Coquand <marc@mccd.space>2024-05-15 14:05:03 -0500
commit3f696169ab1a560d94d169c1a5b744346da4c081 (patch)
treed2aa5d6b0b9d70a594ede7795e423250a92729e1 /lib/grep.ml
parent961339f0bd28c0f30bdb3c995a27927def8a991e (diff)
downloadstitch-3f696169ab1a560d94d169c1a5b744346da4c081.tar.gz
stitch-3f696169ab1a560d94d169c1a5b744346da4c081.tar.bz2
stitch-3f696169ab1a560d94d169c1a5b744346da4c081.zip
Add done view + visual
Diffstat (limited to '')
-rw-r--r--lib/grep.ml12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/grep.ml b/lib/grep.ml
index 6ed2a98..0e8294a 100644
--- a/lib/grep.ml
+++ b/lib/grep.ml
@@ -52,6 +52,14 @@ let pad str n =
exception Not_A_Tuple of string * string
(* todo parsing *)
+let done_get_args = [ grep_cmd; done_pattern_regexp; "-H"; "-r"; "-n"; "--no-messages" ]
+
+let get_done () =
+ let open Shexp_process in
+ let open Shexp_process.Infix in
+ run_calls (call done_get_args |- call [ "sort"; "-n"; "-r" ])
+
+
let todo_get_args = [ grep_cmd; todo_pattern_regexp; "-H"; "-r"; "-n"; "--no-messages" ]
let get_todos () =
@@ -158,6 +166,8 @@ let get_tagged_headlines tag () =
(find_sort_name ()
|- call headline_args
|- call [ grep_cmd; "--no-messages"; "-E"; tag ]
+ |- call filter_todos_args
+ |- call filter_done_args
|- call [ "sort"; "-n"; "-r" ]
|- read_all))
@@ -231,6 +241,6 @@ let pretty_print_parsed_content parsed_files =
List.concat_map
(fun (file_name, line_number, line_content, _) ->
if line_number == 0
- then [ Bold ("------- " ^ file_name); Normal line_content ]
+ then [ Bold ("--------- " ^ file_name); Normal line_content ]
else [ Normal (padding ^ line_content) ])
parsed_files