From ba61dfd69504ec6263a9dee9931d93adeb6f3142 Mon Sep 17 00:00:00 2001 From: Rutger Broekhoff Date: Mon, 7 Jul 2025 21:52:08 +0200 Subject: Initialize repository --- bin/repl_cmd.ml | 178 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 bin/repl_cmd.ml (limited to 'bin/repl_cmd.ml') diff --git a/bin/repl_cmd.ml b/bin/repl_cmd.ml new file mode 100644 index 0000000..9ebeae7 --- /dev/null +++ b/bin/repl_cmd.ml @@ -0,0 +1,178 @@ +open Core +open Option.Let_syntax + +let join_str_list ~sep = function + | [] -> "" + | s :: ss -> List.fold ss ~init:s ~f:(fun acc s -> acc ^ sep ^ s) + +type cmd = { + args : string; + opts : unit -> string list; + next : (string -> (string, cmd) Either.t) option; + call : string list -> bool; +} + +let set_opt_cmd opt setting = + { + args = "