(* Some history implementation that can be used out of the box. *) module Prefix_search : Types.History = struct type t = string list let empty = [] type entry = string let make_entry s = s let add e t = e :: t let history ~command h = if command <> "" then List.filter (fun s -> String.starts_with ~prefix:command s) h else h let commands t = t let save t path = Eio.Path.save ~create:(`If_missing 0o644) path (String.concat "\n" t) let load path = Eio.Path.load path |> String.split_on_char '\n' let pp ppf = Fmt.(list ~sep:(Fmt.any "\n") string) ppf end