module Version:sig
..end
typet =
(string * string) list
val to_string : (string * string) list -> string
to_string t
: convert version data to a string.
The format is two tab-separated fields (name and value) per
line, one line per field.
val data : ?name:string ->
?version:string ->
?ident:string ->
?author:string -> ?www:string -> unit -> (string * string) list
data ?name ?version ?ident ?author ?www ()
: return a minimal version datum as an alist.
It contains values for the keys "argv0";"host";"pwd";"ocaml"
; any optional
parameters provided add values for those fields.
val message : (string * string) list -> string
message t
: return a one-line version message string.
The message is of the form:
This is id3grep v2.38 (e8ee82f28809) by Keith Waclena <http://www.lib.uchicago.edu/keith/>
Fields used from the version datum are (in order):
"name"
(else "argv0"
)"version"
"ident"
"author"
"www"
"UNKNOWN"
will be shown.val interface : Kwapp.interface
val action : (string * string) list -> ('a, unit) Kwapp.action
action versiondata
: a version information action suitable for Kwapp.dispatch
.
This action, if called with an empty argv
, will print
versiondata
to stdout
, as per Kwapp.Version.to_string
.
If invoked via a subcommand (Sub
) (as opposed to a
Switch
), a single field name can be given, and the value
(only) of that field will be printed to stdout
.
These combinators can be used to conveniently modify version
information, adding, changing and removing fields.
val (+) : ('a * 'b) list -> 'a * 'b -> ('a * 'b) list
(+) (name,value)
: add a new field to the end of the version data.Failure
if the field is already present in the version dataval (<+) : ('a * 'b) list -> 'a * 'b -> ('a * 'b) list
(<+) (name,value)
: add a new field to the beginning of the version data.Failure
if the field is already present in the version dataval (-) : ('a * 'b) list -> 'a -> ('a * 'b) list
(-) name
: remove field name
from the version data.val (@) : ('a * 'b) list -> ('a * 'b) list -> ('a * 'b) list
(@) new
: add all the fields in new
to the end of the version data.Failure
if any of the fields are already present in the version dataval (<@) : ('a * 'b) list -> ('a * 'b) list -> ('a * 'b) list
(<@) new
: add all the fields in new
to the beginning of the version data.Failure
if any of the fields are already present in the version dataval (=) : ('a * 'b) list -> 'a * 'b -> ('a * 'b) list
(=) (name,value)
: replace the field name
(if any) with the new pair.val sort : ?compare:('a * 'b -> 'a * 'b -> int) ->
?first:'a list -> ('a * 'b) list -> ('a * 'b) list
sort ?compare ?first
: sort the version data alphabetically by name.
If first
, a list of field names, is given, those fields (if
any) will come at the beginning of the list in the order given,
followed by the remainder of the fields in sorted order.
compare
: comparison function for sortfirst
: list of leading field names