aboutsummaryrefslogtreecommitdiff
path: root/lib/grep.ml
diff options
context:
space:
mode:
authorMarc Coquand <marc@mccd.space>2024-05-15 15:06:49 -0500
committerMarc Coquand <marc@mccd.space>2024-05-15 15:06:49 -0500
commitfa2582d562118dc1ceccd01ede8d0d7e80d71a29 (patch)
tree21a54ab2f3e271bbb8e46cf60b830aedf0297c74 /lib/grep.ml
parent613b17e9f30b4def18e014993576a4324d9b11a4 (diff)
downloadstitch-fa2582d562118dc1ceccd01ede8d0d7e80d71a29.tar.gz
stitch-fa2582d562118dc1ceccd01ede8d0d7e80d71a29.tar.bz2
stitch-fa2582d562118dc1ceccd01ede8d0d7e80d71a29.zip
Add basic file search
Diffstat (limited to 'lib/grep.ml')
-rw-r--r--lib/grep.ml14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/grep.ml b/lib/grep.ml
index f672d01..a801fd7 100644
--- a/lib/grep.ml
+++ b/lib/grep.ml
@@ -256,6 +256,20 @@ let parse_full_content files =
files
+let get_file_names tag =
+ let cmd =
+ let open Shexp_process in
+ let open Shexp_process.Infix in
+ find_sort_name ()
+ |- call [ "xargs"; grep_cmd; "-H"; "-r"; "-l"; "--no-messages"; "-E"; tag ]
+ |- call [ "sort"; "-n"; "-r" ]
+ |- read_all
+ in
+ Shexp_process.eval (Shexp_process.chdir execution_directory cmd)
+ |> String.split_on_char '\n'
+ |> List.filter (fun s -> not (String.equal "" s))
+
+
type display_type =
| Bold of string
| Normal of string