Module UsrBin


module UsrBin: sig .. end
High-level user utilities.


Type Aliases


type ('a -> 'b) fitting = ('a -> 'b) Fitting.t 
High-level user utilities.
type 'a shtream = 'a Shtream.t 
High-level user utilities.
type 'a line = 'a Line.t 
High-level user utilities.
type absent = Line.absent 
High-level user utilities.
type present = Line.present 
High-level user utilities.

Fitting Commands


val ls : string ->
('a ->
< delim : Line.absent; fstab : Line.absent; group : Line.absent;
key_value : Line.absent; mailcap : Line.absent; passwd : Line.absent;
ps : Line.absent; seq : Line.absent; source : present;
stat : < blksize : Line.absent; blocks : Line.absent;
mode : present > >
line)
fitting
List a directory, with file metadata. Given the name of a directory, produces a fitting which outputs filenames with Line.Stat present.
val from_directory : string ->
('a ->
< delim : Line.absent; fstab : Line.absent; group : Line.absent;
key_value : Line.absent; mailcap : Line.absent; passwd : Line.absent;
ps : Line.absent; seq : Line.absent; source : present;
stat : Line.absent >
line)
fitting
Get the filenames in a directory. Doesn't provide metadata.
val ps : unit ->
('a ->
< delim : Line.absent; fstab : Line.absent; group : Line.absent;
key_value : Line.absent; mailcap : Line.absent; passwd : Line.absent;
ps : present; seq : present; source : present;
stat : Line.absent >
line)
fitting
Get a information about currently running processes. Returns a fitting which outputs ps(1) output with process metadata in the Line.Ps structure.
val cut : ('a line -> string) -> ('a Line.t -> 'a Line.t) fitting
Select a particular field for each line passing through the fitting. Given a function to show lines, sets Line.show for each line in the input.
val head : int -> ('a -> 'a) fitting
UsrBin.head n is a fitting that only produces the first n elements of its input. It leaves the rest for subsequent readers.
val head_while : ('a -> bool) -> ('a -> 'a) fitting
A fitting that passes through elements satisfying a predicate until encountering one that doesn't. Leaves the remaining elements behind.
val behead : int -> ('a -> 'a) fitting
UsrBin.behead n is a fitting that drops the first n lines of its input.
val behead_while : ('a -> bool) -> ('a -> 'a) fitting
A fitting that deletes lines satisfying a predicate until reaching one that doesn't.
val echo : string -> ('a -> Line.empty Line.t) fitting
A fitting to print a string.
val renumber : int ->
(< delim : 'a; fstab : 'b; group : 'c; key_value : 'd; mailcap : 'e;
passwd : 'f; ps : 'g; seq : 'h; source : 'i; stat : 'j >
line ->
< delim : 'a; fstab : 'b; group : 'c; key_value : 'd; mailcap : 'e;
passwd : 'f; ps : 'g; seq : present; source : 'i; stat : 'j >
line)
fitting
Update the sequence numbers in the lines passing through the pipeline to reflect the current sequence. The optional argument ?from (default 0) specifies the number for the first element.
val sort : ?compare:('a line -> 'a line -> int) ->
unit -> ('a line -> 'a line) fitting
Sort the lines coming into the fitting. Since UsrBin.sort must eagerly consume its in order to sort it, attempts to sort infinite shtreams will require patience.
val uniq : ?equal:('a line -> 'a line -> bool) ->
unit -> ('a line -> 'a line) fitting
Remove (adjacent) duplicate lines from the fitting's input. When several lines are equal according the the predicate ?equal (default compares Line.show), discards all but the first.

File Commands


val isatty : Channel.descr -> bool
Is the given file descriptor a tty?
val set_stat : ?dir:string ->
< delim : 'a; fstab : 'b; group : 'c; key_value : 'd; mailcap : 'e;
passwd : 'f; ps : 'g; seq : 'h; source : 'i; stat : absent >
line ->
< delim : 'a; fstab : 'b; group : 'c; key_value : 'd; mailcap : 'e;
passwd : 'f; ps : 'g; seq : 'h; source : present;
stat : < blksize : Line.absent; blocks : Line.absent;
mode : present > >
line
Add file metadata to a UsrBin.line. Uses the filename in Line.raw
val stat : string ->
< delim : Line.absent; fstab : Line.absent; group : Line.absent;
key_value : Line.absent; mailcap : Line.absent; passwd : Line.absent;
ps : Line.absent; seq : Line.absent; source : present;
stat : < blksize : Line.absent; blocks : Line.absent;
mode : present > >
line
Get file metadata for one file. Creates a UsrBin.line with Line.Stat present.
module Test: sig .. end
Functions similar to the UNIX test(1) command.

Other Commands


val backquote : string -> string
Run a command and return its output.
val cd : string -> unit
Change the current working directory.
val mkdir : string -> unit
Create a directory.
val mkpath : string -> unit
Create a directory path, succeeding even if some components exist. This is like mkdir(1) with the -p option.
val pwd : unit -> string
Find out the current working directory.
val sleep : int -> unit
Sleep for the given number of seconds.