module Shell:Shell scripting in OCaml.sig
..end
This module contains basic blocks for shell scripting in OCaml. It tends to be
much safer than just using Unix.system
because it handles errors much more
transparently.
WARNING: it's undergoing some serious changes internally, then next public release of
core should have the changes included
module Ansi:sig
..end
module Process:sig
..end
type'a
with_process_flags =?timeout:Core.Std.Time.Span.t option ->
?working_dir:string -> ?verbose:bool -> ?echo:bool -> ?input:string -> 'a
timeout
: the command will raise Failed_command
if the program doesn't
do any IO for this period of timeworking_dir
: run the command in this directoryverbose
: prints the output of the commandecho
: print out the command before running itinput
: a string to pipe through the program's standard intype'a
with_run_flags =(?expect:int list -> 'a) with_process_flags
with_process_flags
.
expect
: an int list of valid return codes. default value is [0]
, if
the return code of the dispatched is not in this list we will blowup with
Process.Failure
type'a
cmd =string -> string list -> 'a
val run : unit cmd with_run_flags
val run_lines : string list cmd with_run_flags
val run_one : string cmd with_run_flags
val run_full : string cmd with_run_flags
type('a, 'b)
sh_cmd =('a, unit, string, 'b) Pervasives.format4 -> 'a
val sh : ('a, unit) sh_cmd with_run_flags
val sh_lines : ('a, string list) sh_cmd with_run_flags
val sh_one : ('a, string) sh_cmd with_run_flags
val sh_full : ('a, string) sh_cmd with_run_flags
type'a
with_test_flags =(?true_v:int list -> ?false_v:int list -> 'a) with_process_flags
val test : bool cmd with_test_flags
val sh_test : ('a, bool) sh_cmd with_test_flags
val mkdir_p : ?perm:Core.Std.Unix.file_perm -> string -> unit
val ls : string -> string list
val quote : string -> string
val is_directory : ?unlink:bool -> string -> bool
val is_file : ?unlink:bool -> string -> bool
val file_kind : string -> Core.Std.Unix.file_kind
val file_exists : string -> bool
val copy_file : ?overwrite:bool ->
?perm:Core.Std.Unix.file_perm -> src:string -> dst:string -> unit
val rm : string -> unit
val cp : string -> string -> unit
val whoami : ?real:bool -> unit -> string
val home : unit -> string
val get_group_names : unit -> string list
val in_group : string -> bool
val hostname : unit -> string
val which : string -> string option
val get_editor : unit -> string option
val mkdir_p : ?perm:Core.Std.Unix.file_perm -> string -> unit
val ls : string -> string list
val quote : string -> string
val (^/) : string -> string -> string
val ssh : user:string -> host:string -> string -> unit
val scp : ?recurse:bool -> user:string -> host:string -> string -> string -> unit
val echo : ('a, Pervasives.out_channel, unit) Pervasives.format -> 'a
val warnf : ('a, unit, string, unit) Pervasives.format4 -> 'a
val email : string -> string Core.Std.List.container -> string -> string -> unit