aboutsummaryrefslogtreecommitdiff
path: root/lib/grep.ml
diff options
context:
space:
mode:
authorMarc Coquand <marc@mccd.space>2024-05-20 09:07:45 -0500
committerMarc Coquand <marc@mccd.space>2024-05-20 09:07:45 -0500
commit5aec082b915416107cec9e8c811bbbedafb70b59 (patch)
treea39601d40898e332508d9708014e0415c069b01b /lib/grep.ml
parent0bc408515cfc9c8feff686f8c758dfaf6c997bb4 (diff)
downloadstitch-5aec082b915416107cec9e8c811bbbedafb70b59.tar.gz
stitch-5aec082b915416107cec9e8c811bbbedafb70b59.tar.bz2
stitch-5aec082b915416107cec9e8c811bbbedafb70b59.zip
Enable hiding the file name using 'h'
Diffstat (limited to '')
-rw-r--r--lib/grep.ml14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/grep.ml b/lib/grep.ml
index c5acbb6..94b4b48 100644
--- a/lib/grep.ml
+++ b/lib/grep.ml
@@ -94,10 +94,13 @@ let parse_todo_string s =
| _ -> raise (Not_A_Tuple (String.concat " SPLIT " split, message))))
-let pretty_format_todo parsed_headlines =
+let pretty_format_todo ?(hide_file_name = false) parsed_headlines =
let padding = get_padding_list parsed_headlines in
List.map
- (fun (file_name, content) -> String.concat " | " [ pad file_name padding; content ])
+ (fun (file_name, content) ->
+ if not hide_file_name
+ then String.concat " | " [ pad file_name padding; content ]
+ else content)
parsed_headlines
@@ -236,10 +239,13 @@ let parse_headlines s =
(** Turns "2024-03-05.org:* Hello world" into "2024-03-05 | * Hello world" *)
-let pretty_format parsed_headlines =
+let pretty_format ?(hide_file_name = false) parsed_headlines =
let padding = get_padding_arr parsed_headlines in
Array.map
- (fun (file_name, content) -> String.concat " | " [ pad file_name padding; content ])
+ (fun (file_name, content) ->
+ if not hide_file_name
+ then String.concat " | " [ pad file_name padding; content ]
+ else content)
parsed_headlines