Module Line.Key_value


module Key_value: sig .. end
Line structure to represent associations of keys with values.

val key : < key_value : < .. >; .. > Line.t -> string
The key of a key-value pair. (accessor, required)
val set_key : string -> (< key_value : < .. >; .. > as 'a) Line.t -> 'a Line.t
Updater for Line.Key_value.key
val value : < key_value : < .. >; .. > Line.t -> string
The value of a key-value pair. (accessor, required)
val set_value : string -> (< key_value : < .. >; .. > as 'a) Line.t -> 'a Line.t
Updater for Line.Key_value.value
val as_int : < key_value : < .. >; .. > Line.t -> int option
The value of the key-value pair, as an integer.
val as_float : < key_value : < .. >; .. > Line.t -> float option
The value of the key-value pair, as an float.
val as_bool : < key_value : < .. >; .. > Line.t -> bool option
The value of the key-value pair, as a boolean. The strings yes, y, 1, true, on, enabled, and enable are all considered true. The strings no, n, 0, false, off, disabled, and disable are all considered false. (Case insensitive.)
val as_string : ?quoted:bool -> < key_value : < .. >; .. > Line.t -> string
The value of the string with interpreted escapes. Backslash escapes are interpreted in the style of echo(1). The optional argument ?quoted (default true) specifies whether to remove double-quotes from the string as well (unless they are escaped).
val as_list : ?delim:char -> < key_value : < .. >; .. > Line.t -> string list
The value, split into a list. The optional argument ?delim (default ' ') specifies the list separator.
val section : < key_value : < section : Line.present; .. >; .. > Line.t -> string
The section in a key-value file. For example, in SSH configuration files, Host statements begin a new section. (accessor, nullable)
val set_section : string ->
< delim : 'a; fstab : 'b; group : 'c; key_value : < section : 'd >;
mailcap : 'e; passwd : 'f; ps : 'g; seq : 'h; source : 'i; stat : 'j >
Line.t ->
< delim : 'a; fstab : 'b; group : 'c; key_value : < section : Line.present >;
mailcap : 'e; passwd : 'f; ps : 'g; seq : 'h; source : 'i; stat : 'j >
Line.t
Updater for Line.Key_value.section
val create : key:string ->
value:string ->
< delim : 'a; fstab : 'b; group : 'c; key_value : Line.absent; mailcap : 'd;
passwd : 'e; ps : 'f; seq : 'g; source : 'h; stat : 'i >
Line.t ->
< delim : 'a; fstab : 'b; group : 'c; key_value : < section : Line.absent >;
mailcap : 'd; passwd : 'e; ps : 'f; seq : 'g; source : 'h; stat : 'i >
Line.t
Add the Line.Key_value substructure to a line.