Shells in OCaml
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix history

+6 -1
+6 -1
src/lib/interactive.ml
··· 69 69 70 70 let h = ref [] 71 71 72 + let add_history c = 73 + let c = String.trim c in 74 + let new_h = List.filter (fun s -> not (String.equal c s)) !h in 75 + h := c :: new_h 76 + 72 77 let history prefix = 73 78 if prefix <> "" then List.filter (fun s -> String.starts_with ~prefix s) !h 74 79 else !h ··· 90 95 | String (Some c) -> 91 96 let ast = Ast.of_string (String.trim c) in 92 97 let ctx', _ast = Eval.run ctx ast in 93 - h := c :: !h; 98 + add_history c; 94 99 loop ctx' 95 100 | Ctrl_c -> 96 101 let c = Exit.value ctx in