forked from
patrick.sirref.org/merry
Shells in OCaml
1module Options : sig
2 type t = {
3 noclobber : bool;
4 pipefail : bool;
5 no_path_expansion : bool;
6 no_unset : bool;
7 async : bool;
8 }
9
10 type posix = [ `Noclobber | `Pipefail | `Noglob | `Nounset ]
11 type merry = [ `Async ]
12 type option = [ posix | merry ]
13
14 val default : t
15
16 val with_options :
17 ?noclobber:bool ->
18 ?pipefail:bool ->
19 ?async:bool ->
20 ?no_path_expansion:bool ->
21 ?no_unset:bool ->
22 t ->
23 t
24
25 val update : t -> option list -> t
26 val pp : t Fmt.t
27end
28
29type set = { update : Options.option list; print_options : bool }
30type hash = Hash_remove | Hash_stats | Hash_add of string list
31type trap = Int of int | Action of string | Ignore | Default
32
33type t =
34 | Cd of { path : string option }
35 (** Change directory to a path (if [None] then it should be [HOME]) *)
36 | Pwd
37 | Exit of int
38 | Set of set
39 | Wait of int
40 | Dot of string
41 | Unset of [ `Variables of string list | `Functions of string list ]
42 | Hash of hash
43 | Command of { print_command : bool; args : string list }
44 | Alias
45 | Unalias
46 | Eval of string list
47 | Echo of string list
48 | Trap of trap * [ `Signal of Eunix.Signals.t | `Exit ] list
49
50val of_args : string list -> (t, string) result option
51(** Parses a command-line to the built-ins, errors are returned if parsing. *)