diff options
Diffstat (limited to '')
-rw-r--r-- | lib/grep.ml | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/lib/grep.ml b/lib/grep.ml index 0b3c10b..9855b6f 100644 --- a/lib/grep.ml +++ b/lib/grep.ml @@ -124,11 +124,14 @@ let get_full_file_content_content file = let parse_full_content files = - List.concat_map - (fun ((file_name : string), content) -> - let content = String.split_on_char '\n' content in - List.mapi (fun line_number line -> file_name, line_number, line) content) - files + List.concat + @@ List.mapi + (fun file_number ((file_name : string), content) -> + let content = String.split_on_char '\n' content in + List.mapi + (fun line_number line -> file_name, line_number, line, file_number) + content) + files type display_type = @@ -138,17 +141,8 @@ type display_type = let pretty_print_parsed_content parsed_files = let padding = String.make headline_pattern_length ' ' in List.concat_map - (fun (file_name, line_number, line_content) -> + (fun (file_name, line_number, line_content, _) -> if line_number == 0 then [ Bold ("------- " ^ file_name); Normal line_content ] else [ Normal (padding ^ line_content) ]) parsed_files - -(* let parse_file_headline collection full = *) -(* match full with *) -(* | s :: r -> *) -(* let split = Str.bounded_split (Str.regexp ":1:") s 1 in *) -(* (match split with *) -(* (\* file, line, content *\) *) -(* | [ file_name; content ] -> file_name, content *) -(* | rest -> *) |