package opam-format

  1. Overview
  2. Docs
type t = {
  1. opam_version : OpamVersion.t;
  2. synopsis : string;
  3. repos : OpamTypes.repository_name list option;
  4. paths : (OpamTypes.std_path * string) list;
  5. variables : (OpamTypes.variable * OpamTypes.variable_contents) list;
  6. opam_root : OpamTypes.dirname option;
  7. wrappers : Wrappers.t;
  8. env : OpamTypes.env_update list;
  9. invariant : OpamFormula.t option;
  10. depext_bypass : OpamSysPkg.Set.t;
}
val file_format_version : OpamVersion.t
val path : t -> OpamTypes.std_path -> string option
val wrappers : t -> Wrappers.t
val sections : (string * (t, (string option * OpamParserTypes.FullPos.opamfile_item list) list) OpamPp.field_parser) list
val fields : (string * (t, OpamParserTypes.FullPos.value) OpamPp.field_parser) list
val to_list : ?filename:'a typed_file -> t -> (string * OpamParserTypes.FullPos.value) list
include IO_FILE with type t := t
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 -> in_channel -> t
val read_from_string : ?filename:t typed_file -> string -> t
val write_to_channel : ?filename:t typed_file -> out_channel -> t -> unit
val write_to_string : ?filename:t typed_file -> t -> string
val oldest_compatible_format_version : OpamVersion.t
module BestEffort : BestEffortRead with type t := t