package opam-lib
Install
dune-project
Dependency
Authors
-
TThomas Gazagnaire <thomas@gazagnaire.org>
-
AAnil Madhavapeddy <anil@recoil.org>
-
FFabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
-
FFrederic Tuong <tuong@users.gforge.inria.fr>
-
LLouis Gesbert <louis.gesbert@ocamlpro.com>
-
GGuillem Rieu <guillem.rieu@ocamlpro.com>
-
VVincent Bernardoff <vb@luminar.eu.org>
-
RRoberto Di Cosmo <roberto@dicosmo.org>
Maintainers
Sources
sha256=625767c3465219cc8799aad1449c74279b31686db0821300cfdb92fbff17e9fd
md5=e0688c0cf9a55f93ee93f62d07cf6b74
doc/opam-lib.format/OpamFilter/index.html
Module OpamFilter
Manage filters
Filters are a small language of formulas over strings and booleans used for conditions and text replacements. It has relational operators over strings (using version-number comparison), And, Or and Not boolean operations, dynamic casting (using strings "true" and "false"), and string interpolation. Variables are resolved using a user function returning an option, undefined values are propagated.
String interpolation uses the syntax '%dentifier%'
Identifiers have the form
[package:]var[?str_if_true:str_if_false_or_undef]v}. The last optional part specifies a conversion from boolean to static strings. The syntax [pkg1+pkg2+pkgn:var] is allowed as a shortcut to [pkg1:var & pkg2:var & pkgn:var]. The special variable [pkg:enable] is allowed as a shortcut for [pkg:installed?enable:disable]
val to_string : OpamTypes.filter -> stringPretty-print
val fold_down_left :
('a -> OpamTypes.filter -> 'a) ->
'a ->
OpamTypes.filter ->
'aFolds on the tree of a filter
val variables : OpamTypes.filter -> OpamTypes.full_variable listReturns all the variables appearing in a filter (including the ones within string interpolations
type env = OpamTypes.full_variable -> OpamTypes.variable_contents optionType of filter environment.
type fident =
OpamTypes.name list * OpamTypes.variable * (string * string) optionThe type of filter idents with (optionally multiple) qualifying package names and optional string converter
val expand_string : env -> string -> stringRewrites string interpolations within a string
val eval :
?default:OpamTypes.variable_contents ->
env ->
OpamTypes.filter ->
OpamTypes.variable_contentsComputes the value of a filter. May raise Failure if default isn't provided
val eval_to_bool : ?default:bool -> env -> OpamTypes.filter -> boolLike to_value but casts the result to a bool. Raises Invalid_argument if not a valid bool and no default supplied.
val opt_eval_to_bool : env -> OpamTypes.filter option -> boolSame as eval_to_bool, but takes an option as filter and returns always true on None, false when the filter is Undefined. This is the most common behaviour for using "filters" for filtering
val eval_to_string : ?default:string -> env -> OpamTypes.filter -> stringLike to_value but casts the result to a string
val ident_of_var : OpamTypes.full_variable -> fidentWraps a full_variable into a fident accessor
val ident_of_string : string -> fidentA fident accessor directly referring a variable with the given name
val ident_value :
?default:OpamTypes.variable_contents ->
env ->
fident ->
OpamTypes.variable_contentsResolves a filter ident. Like eval, may raise Failure if no default is provided
Like ident_value, but casts the result to a string
Like ident_value, but casts the result to a bool
val expand_interpolations_in_file : env -> OpamTypes.basename -> unitRewrites basename.in to basename, expanding interpolations
val commands : env -> OpamTypes.command list -> string list listProcesses filters evaluation in a command list: parameter expansion and conditional filtering
val single_command : env -> OpamTypes.arg list -> string listProcess a simpler command, without filters
val commands_variables : OpamTypes.command list -> OpamTypes.full_variable listExtracts variables appearing in a list of commands