package opam-format

  1. Overview
  2. Docs

.config files

include IO_FILE
type t

File contents

val format_version : OpamVersion.t
val empty : t

Empty file

val write : t typed_file -> t -> unit

Write some contents to a file

val read : t typed_file -> t

Read file contents. Raise an error if the file does not exist.

val read_opt : t typed_file -> t option

Returns None on non-existing file

val safe_read : t typed_file -> t

Read file contents. Return empty if the file does not exist.

val read_from_channel : ?filename:t typed_file -> Stdlib.in_channel -> t
val read_from_string : ?filename:t typed_file -> string -> t
val write_to_channel : ?filename:t typed_file -> Stdlib.out_channel -> t -> unit
val write_to_string : ?filename:t typed_file -> t -> string

Create a new .config file (containing only variables)

val file_depends : t -> (OpamTypes.filename * OpamHash.t) list

Dependency towards file-system paths and their hashes

val with_file_depends : (OpamTypes.filename * OpamHash.t) list -> t -> t
val with_vars : (OpamTypes.variable * OpamTypes.variable_contents) list -> t -> t

Sets all bindings in the file

Top-level variables

val variables : t -> OpamTypes.variable list

The list of top-level variables

Lists all the variable bindings in the file

Sets the given variable, overriding any previous definition. With None, unsets the variable


Innovation. Community. Security.