Module UsrBin

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


Fitting Commands


val ls : string -> ('a -> Line.t) Fitting.t
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 -> Line.t) Fitting.t
Get the filenames in a directory. Doesn't provide metadata.
val ps : unit -> ('a -> Line.t) Fitting.t
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 : (Line.t -> string) -> (Line.t -> Line.t) Fitting.t
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.t
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.t
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.t
UsrBin.behead n is a fitting that drops the first n lines of its input.
val behead_while : ('a -> bool) -> ('a -> 'a) Fitting.t
A fitting that deletes lines satisfying a predicate until reaching one that doesn't.
val echo : string -> ('a -> Line.t) Fitting.t
A fitting to print a string.
val renumber : int -> (Line.t -> Line.t) Fitting.t
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:(Line.t -> Line.t -> int) -> unit -> (Line.t -> Line.t) Fitting.t
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:(Line.t -> Line.t -> bool) -> unit -> (Line.t -> Line.t) Fitting.t
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 -> Line.t -> Line.t
Add file metadata to a line. Uses the filename in Line.raw
val stat : string -> Line.t
Get file metadata for one file. Creates a 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.