Up

module Mirage_misc

: sig

Utility module.

Misc

#
val generated_by_mirage : string

The header string for every generated file.

#
val ocaml_version : unit -> int * int

The version of the current OCaml compiler.

#
val (/) : string -> string -> string

Same as Filename.concat.

String utilities

#
val strip : string -> string

Remove heading and trailing spaces.

#
val cut_at : string -> char -> (string * string) option

Cut at the first occurence of a given character.

#
val split : string -> char -> string list

Split at each occurence of the given character.

#
val after : string -> string -> string option

after prefix s returns the part of s after prefix, if s starts with prefix.

Channels

#
val append : Pervasives.out_channel -> ('a, unit, string, unit) Pervasives.format4 -> 'a
#
val newline : Pervasives.out_channel -> unit

Command-line utilities

#
val command_exists : string -> bool
#
val command : ?redirect:bool -> ('a, unit, string, unit) Pervasives.format4 -> 'a
#
val read_command : ('a, unit, string, string) Pervasives.format4 -> 'a
#
val remove : string -> unit
#
val realpath : string -> string
#
val opam : string -> ?switch:string -> string list -> unit
#
val in_dir : string -> (unit -> 'a) -> 'a
#
val uname_s : unit -> string option
#
val uname_m : unit -> string option
#
val uname_r : unit -> string option

Display

#
val set_section : string -> unit
#
val get_section : unit -> string
#
val error : ('a, unit, string, 'b) Pervasives.format4 -> 'a
#
val info : ('a, unit, string, unit) Pervasives.format4 -> 'a
#
val blue_s : string -> string
#
val yellow_s : string -> string

Hash tables

#
val cofind : ('a, 'b) Hashtbl.t -> 'b -> 'a

Can raise Not_found.

#
val find_or_create : ('a, 'b) Hashtbl.t -> 'a -> (unit -> 'b) -> 'b

Find the value associated with a key in an hash-table or create a new value if it the key is not already in there.

#
val dump : (string, string) Hashtbl.t -> unit

Dump the contents of a hash table to stderr.

#
val dedup : string list -> string list

Deduplicate the list elements. Return an ordered list.

end