Something went wrong. Try again.
Shells in OCaml
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192open Eio.Std
(** Shell evaluation.
This module provides the main evaluator for any shell. It requires users to provide a {! Types.State} module and a {! Types.Exec} module. *)module Make (S : Types.State) (Fd : Types.Fd) (E : Types.Exec with type fd = Fd.t) : sig type environ (** Environments. *)
module Context : Types.Context with type state = S.t
type t (** Contexts, the shell state and environment needed for running an evaluation. *)
module J : Types.Job with type process = E.process
type config (** Configure the shell. *)
val make_config : ?merge:bool -> ?tracing:bool -> unit -> config
val make_ctx : ?config:config -> ?build:Zfs_store.Build.t -> ?overlays:Zfs_store.Build.t list -> ?interactive:bool -> ?toplevel:bool -> ?subshell:bool -> ?background_jobs:t J.t list -> ?last_background_process:string -> ?current_pipeline:string -> ?last_pipeline_status:int -> ?functions:(string * Sast.compound_command) list -> ?exit_handler:Ast.complete_commands -> ?options:Options.t -> ?hash:Hash.t -> ?umask:int -> ?built_ins:string list * (string list -> t -> t Exit.t) -> async_switch:Switch.t -> program:string -> argv:string array -> store_dir:_ Eio.Path.t -> S.t -> E.t -> Fd_table.t -> < Types.env ; .. > -> t
val exit_from_eval : t Exit.t -> unit (** Will exit with the correct exit code and run any exit handlers. *)
val env : t -> Types.env (** Retrieve the current context environment. *)
val state : t -> S.t (** Return the current state of the context. *)
val sigint_set : t -> bool (** Has the signal SIGINT been set via a trap. *)
val trace : t -> Trace.t (** The trace. *)
val ctx : t -> Context.ctx (** Get the persistent context. *)
val current_session : t -> string option * string option (** Returns the current head and session of the context. *)
val is_committing : t -> bool (** Whether or not the current evaluator will be committing the results. *)
val run : ?make_process_group:bool -> t Exit.t -> Ast.t -> t Exit.t * Ast.t list (** [run ctx ast] evaluates [ast] using the initial [ctx]. *)
(** {2 Private} *)
val word_expansion : ?collect:string -> ?update:bool -> t -> Ast.word_cst -> t Exit.t * S.variable list (* Mostly for testing purposes, this exposes the logic for expanding words. *)end