module type S =sig..end
type ('b -> 'c) t
'a and produces
values of type 'b.type 'a elem
type initial
FittingSig.S.elem for specifying
the type of elements that fittings know how to read from
external processes. That is, fittings constructed from external
processes produce values of type initial elem.type 'a shtream
type 'a coshtream
typeprocref =Channel.procref
Channel.procreftypetext =initial elem
val (-|) : ('a -> 'b) t ->
('b -> 'c) t -> ('a -> 'c) tval pipe : ('i -> 'm) t ->
('m -> 'o) t -> ('i -> 'o) tFittingSig.S.(-|)
Producers are useful for starting off pipelines.
val from_file : string -> ('i -> text) tfrom_file file -| fitting is like % fitting < file
val from_null : ('i -> text) tfrom_null -| fitting is like % fitting < /dev/null
val from_gen : Channel.dup_in_source -> ('i -> text) tChannel.dup_in_source.val from_shtream : 'o shtream -> ('i -> 'o) t
Consumers are useful for ending pipelines.
val to_file : ?clobber:Channel.clobber_spec ->
string -> ('i elem -> 'o) tChannel.clobber_spec for open modes.
fitting -| to_file file is like % fitting > file
val to_null : ('i elem -> 'o) tfitting -| to_null is like % fitting > /dev/null
val to_stderr : ('i elem -> 'o) tfitting -| to_stderr is like % fitting >&2
val to_gen : Channel.dup_out_source -> ('i elem -> 'o) tChannel.dup_out_source.val to_coshtream : 'i coshtream -> ('i -> 'o) tval command : string -> ('i elem -> text) tChannel.open_command.val program : ?path:bool ->
string ->
?argv0:string ->
string list -> ('i elem -> text) tChannel.open_program.val thunk : (unit -> unit) -> ('i elem -> text) tval sed : ('i -> 'o) -> ('i -> 'o) tval grep : ('i -> bool) -> ('i -> 'i) tval trans : ('i shtream -> 'o shtream) ->
('i -> 'o) tval sed_string : (string -> 'o) -> ('i elem -> 'o) tFittingSig.S.sed with a lift from strings.val grep_string : (string -> bool) ->
('i elem -> 'i elem) tval (/</) : (text -> 'o) t ->
Channel.dup_spec -> (text -> 'o) tfitting /</ dups
performs the redirections specifed by dups for the extent
of fitting. For example,
fitting /</ [ 4 %<& 0; 0 %< "file" ] is like
% fitting 4<&0 <file
val redirect_in : Channel.dup_spec ->
(text -> 'o) t ->
(text -> 'o) tFittingSig.S.(/</)val (/>/) : ('i -> 'o elem) t ->
Channel.dup_spec -> ('i -> 'o elem) tfitting />/ dups
performs the redirections specifed by dups for the extent
of fitting. For example,
fitting />/ [ 2 %>& 1 ] is like
% fitting 2>&1
val redirect_out : Channel.dup_spec ->
('i -> 'o elem) t ->
('i -> 'o elem) tFittingSig.S.(/>/)val (^>>=) : ('i -> 'o) t ->
(Proc.status -> ('i -> 'o) t) -> ('i -> 'o) t
The exit code of external processes is the actual exit code as
reported by Proc.wait. The exit code of a shtream is 0 unless
the shtream terminates by calling Shtream.fail_with n, in which
case the code in n. Or, FittingSig.S.yield can return an exit code
directly.
val seq : ('i -> 'o) t ->
(Proc.status -> ('i -> 'o) t) -> ('i -> 'o) tFittingSig.S.(^>>=)val (^>>) : ('i -> 'o) t ->
('i -> 'o) t -> ('i -> 'o) t a ^>> b is exactly a ^>>= fun _ -> b .
This is like ; in the shell.val (&&^) : ('i -> 'o) t ->
('i -> 'o) t -> ('i -> 'o) t&& in the shell.val (||^) : ('i -> 'o) t ->
('i -> 'o) t -> ('i -> 'o) t|| in the shell.val (~>>) : ('i -> 'o) t list -> ('i -> 'o) tFittingSig.S.(^>>).val (~&&) : ('i -> 'o) t list -> ('i -> 'o) tFittingSig.S.(&&^).
Terminates the sequence when any component fails.val (~||) : ('i -> 'o) t list -> ('i -> 'o) tFittingSig.S.(||^).
Terminates the sequence when any component succeeds.val commands : string list -> (text -> text) tval yield : Proc.status -> ('i -> 'o) tval caml : (unit -> ('i -> 'o) t) -> ('i -> 'o) tFittingSig.S.caml constructs a new fitting that,
when run, forces the thunk and runs the resulting fitting.
This allows for OCaml side-effects at arbitrary points during a
fitting.val (^&=) : (text -> 'b elem) t ->
(Proc.t -> ('i -> 'o) t) -> ('i -> 'o) t bg ^&= fg runs bg
in the background, passed its Proc.t to fg, and runs
the fitting returned by fg (in the foreground).
Notice that the bg must have input type FittingSig.S.text; it will
construct its own input shtream from the standard input.
val par : (text -> 'b elem) t ->
(Proc.t -> ('i -> 'o) t) -> ('i -> 'o) tFittingSig.S.(^&=)val (^&) : (text -> 'b elem) t ->
('i -> 'o) t -> ('i -> 'o) tProc.t. This
backgrounds its first argument and then continues with its second
argument in the foreground.val run_source : (text -> 'o) t -> 'o shtreamval run_sink : ('i -> 'o elem) t -> 'i coshtreamval run_list : (text -> 'o) t -> 'o listval run_shtream : ('i -> 'o) t ->
'i shtream -> 'o shtreamval run_in : ?procref:procref ->
(text -> 'o elem) t ->
Pervasives.in_channelin_channel. The fitting
will take its input from the standard input. If ?procref is
provided, the Proc.t of the child process will be stashed.val run_out : ?procref:procref ->
(text -> 'o elem) t ->
Pervasives.out_channelout_channel. The fitting
will send its output from the standard output. If ?procref is
provided, the Proc.t of the child process will be stashed.val run_backquote : ?procref:procref ->
(text -> 'o elem) t -> string?procref.val run_bg : (text -> 'o elem) t -> Proc.tProc.t.
The fitting will take its input from the standard input and send
its output to the standard output.val run : (text -> 'o elem) t -> Proc.status
These conversions use the FittingSig.S.elem conversions provided to the
Fitting.Make functor by AnyShtream.ELEM. The conversion
AnyShtream.ELEM.string_of or AnyShtream.ELEM.of_string
is completely applied for each of these conversions, so no state
(should there be any) is retained in between calls.
val string_of_elem : 'a elem -> stringval elem_of_string : string -> textval int_of_elem : 'a elem -> intval elem_of_int : int -> textval char_of_elem : 'a elem -> charval elem_of_char : char -> textval float_of_elem : 'a elem -> floatval elem_of_float : float -> textval bool_of_elem : 'a elem -> boolval elem_of_bool : bool -> text