let h = ref [] let history prefix = if prefix <> "" then List.filter (fun s -> String.starts_with ~prefix s) !h else !h let complete s = match String.get s 0 with | 'h' -> [ "hello"; "hello there" ] | _ | (exception Invalid_argument _) -> [] let () = Fmt_tty.setup_std_outputs (); let rec loop sys_break = let prompt = if sys_break then "[\x1b[31m130\x1b[0m] \x1b[33m>>\x1b[0m " else "\x1b[33m>>\x1b[0m " in match Bruit.bruit ~history ~complete prompt with | String (Some s) -> Fmt.pr "\n%s\n%!" s; h := s :: !h; loop false | String None -> () | Ctrl_c -> loop true in loop false