From fa2582d562118dc1ceccd01ede8d0d7e80d71a29 Mon Sep 17 00:00:00 2001 From: Marc Coquand Date: Wed, 15 May 2024 15:06:49 -0500 Subject: Add basic file search --- lib/grep.ml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/grep.ml') 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 -- cgit v1.2.3