package opam-client

  1. Overview
  2. Docs

Command-line argument parsers and helpers

Helpers and argument constructors

CLI versioning

type validity
val cli2_0 : OpamCLIVersion.t
val cli2_1 : OpamCLIVersion.t
val cli2_2 : OpamCLIVersion.t
val cli_from : ?platform:[ `all | `windows | `unix ] -> ?experimental:bool -> OpamCLIVersion.t -> validity
val cli_between : ?option:[ `experimental | `default ] -> OpamCLIVersion.t -> ?replaced:string -> OpamCLIVersion.t -> validity
val cli_original : validity

Common helphers

val mk_flag : cli:OpamCLIVersion.Sourced.t -> validity -> ?section:string -> string list -> string -> bool Cmdliner.Term.t
val mk_flag_replaced : cli:OpamCLIVersion.Sourced.t -> ?section:string -> (validity * string list) list -> string -> bool Cmdliner.Term.t
val mk_opt : cli:OpamCLIVersion.Sourced.t -> validity -> ?section:string -> ?vopt:'a -> string list -> string -> string -> 'a Cmdliner.Arg.conv -> 'a -> 'a Cmdliner.Term.t
val mk_opt_all : cli:OpamCLIVersion.Sourced.t -> validity -> ?section:string -> ?vopt:'a -> ?default:'a list -> string list -> string -> string -> 'a Cmdliner.Arg.conv -> 'a list Cmdliner.Term.t
val mk_vflag : cli:OpamCLIVersion.Sourced.t -> ?section:string -> 'a -> (validity * 'a * string list * string) list -> 'a Cmdliner.Term.t
val mk_vflag_all : cli:OpamCLIVersion.Sourced.t -> ?section:string -> ?default:'a list -> (validity * 'a * string list * string) list -> 'a list Cmdliner.Term.t
val dir_sep : string
val escape_path : string -> string

Flags

val print_short_flag : ?section:string -> OpamCLIVersion.Sourced.t -> validity -> bool Cmdliner.Term.t

--short

val shell_opt : ?section:string -> OpamCLIVersion.Sourced.t -> validity -> OpamTypes.shell option Cmdliner.Term.t

--shell

val dot_profile_flag : ?section:string -> OpamCLIVersion.Sourced.t -> validity -> OpamTypes.filename option Cmdliner.Term.t

--dot-profile

val repo_kind_flag : ?section:string -> OpamCLIVersion.Sourced.t -> validity -> OpamUrl.backend option Cmdliner.Term.t

--http/ --git/ --local

val jobs_flag : ?section:string -> OpamCLIVersion.Sourced.t -> validity -> int option Cmdliner.Term.t

--jobs

val formula_flag : ?section:string -> OpamCLIVersion.Sourced.t -> OpamTypes.formula Cmdliner.Term.t

--formula

val name_list : OpamTypes.name list Cmdliner.Term.t

package names

val param_list : string list Cmdliner.Term.t

parameters

val atom_list : OpamFormula.atom list Cmdliner.Term.t

package list with optional constraints

val nonempty_atom_list : OpamFormula.atom list Cmdliner.Term.t

package list with optional constraints

val atom_or_local_list : [ `Atom of OpamTypes.atom | `Filename of OpamTypes.filename | `Dirname of OpamTypes.dirname ] list Cmdliner.Term.t
val atom_or_dir_list : [ `Atom of OpamTypes.atom | `Dirname of OpamTypes.dirname ] list Cmdliner.Term.t
val arg_list : string -> string -> 'a Cmdliner.Arg.conv -> 'a list Cmdliner.Term.t

Generic argument list builder

val nonempty_arg_list : string -> string -> 'a Cmdliner.Arg.conv -> 'a list Cmdliner.Term.t

Generic argument list builder

val confirm_enum : (validity * string * OpamStd.Config.answer) list

Confirmation level enum

Global options

type global_options = {
  1. debug_level : int option;
  2. verbose : int;
  3. quiet : bool;
  4. color : OpamStd.Config.when_ option;
  5. opt_switch : string option;
  6. confirm_level : OpamStd.Config.answer option;
  7. yes : bool option;
  8. strict : bool;
  9. opt_root : OpamTypes.dirname option;
  10. git_version : bool;
  11. external_solver : string option;
  12. use_internal_solver : bool;
  13. cudf_file : string option;
  14. solver_preferences : string option;
  15. best_effort : bool;
  16. safe_mode : bool;
  17. json : string option;
  18. no_auto_upgrade : bool;
  19. working_dir : bool;
  20. ignore_pin_depends : bool;
  21. cli : OpamCLIVersion.t;
}

Type for global options

val global_options : OpamCLIVersion.Sourced.t -> global_options Cmdliner.Term.t

Global options

val apply_global_options : OpamCLIVersion.Sourced.t -> global_options -> unit

Apply global options

Build options

type build_options

Abstract type for build options

val man_build_option_section : Cmdliner.Manpage.block list
val build_options : OpamCLIVersion.Sourced.t -> build_options Cmdliner.Term.t

Build options

val assume_built : ?section:string -> OpamCLIVersion.Sourced.t -> bool Cmdliner.Term.t

Install and reinstall options

val recurse : ?section:string -> OpamCLIVersion.Sourced.t -> bool Cmdliner.Term.t
val subpath : ?section:string -> OpamCLIVersion.Sourced.t -> OpamTypes.subpath option Cmdliner.Term.t
val apply_build_options : OpamCLIVersion.Sourced.t -> build_options -> unit

Applly build options

val locked : ?section:string -> OpamCLIVersion.Sourced.t -> bool Cmdliner.Term.t

Lock options

val lock_suffix : ?section:string -> OpamCLIVersion.Sourced.t -> string Cmdliner.Term.t

Package listing and filtering options

val package_selection_section : string

Man section name

val post : ?section:string -> OpamCLIVersion.Sourced.t -> bool Cmdliner.Term.t

Some package selection flags. Default section is âckage seletion one

val dev : ?section:string -> OpamCLIVersion.Sourced.t -> bool Cmdliner.Term.t
val doc_flag : ?section:string -> OpamCLIVersion.Sourced.t -> bool Cmdliner.Term.t
val test : ?section:string -> OpamCLIVersion.Sourced.t -> bool Cmdliner.Term.t
val dev_setup : ?section:string -> OpamCLIVersion.Sourced.t -> bool Cmdliner.Term.t
val package_selection : OpamCLIVersion.Sourced.t -> OpamListCommand.selector list Cmdliner.Term.t

Build a package selection filter

val package_listing_section : string

Man section name

val package_listing : OpamCLIVersion.Sourced.t -> (force_all_versions:bool -> OpamListCommand.package_listing_format) Cmdliner.Term.t

Package selection filter based on the current state of packages (installed, available, etc.)

Converters

val repository_name : OpamTypes.repository_name Cmdliner.Arg.conv

Repository name converter

val url : OpamTypes.url Cmdliner.Arg.conv

URL converter

val filename : OpamTypes.filename Cmdliner.Arg.conv

Filename converter

val existing_filename_or_dash : OpamTypes.filename option Cmdliner.Arg.conv

Filename converter also accepting "-" for stdin/stdout

val dirname : OpamTypes.dirname Cmdliner.Arg.conv

Dirnam converter

val existing_filename_dirname_or_dash : OpamFilename.generic_file option Cmdliner.Arg.conv
val positive_integer : int Cmdliner.Arg.conv
val package_name : OpamTypes.name Cmdliner.Arg.conv

Package name converter

val package_version : OpamTypes.version Cmdliner.Arg.conv

Package version converter

val package : (OpamTypes.name * OpamTypes.version option) Cmdliner.Arg.conv

name{.version} (or name=version)

val package_with_version : OpamTypes.package Cmdliner.Arg.conv

name.version (or name=version)

val atom : OpamTypes.atom Cmdliner.Arg.conv

name{(.|=|!=|>|<|>=|<=)version} converter

val atom_or_local : [ `Atom of OpamTypes.atom | `Filename of OpamTypes.filename | `Dirname of OpamTypes.dirname ] Cmdliner.Arg.conv

Accepts atom but also (explicit) file and directory names

val atom_or_dir : [ `Atom of OpamTypes.atom | `Dirname of OpamTypes.dirname ] Cmdliner.Arg.conv
val dep_formula : OpamTypes.formula Cmdliner.Arg.conv

Formula, in the same format as depends: in opam files

val variable_bindings : (OpamVariable.t * string) list Cmdliner.Arg.conv

var=value,... argument

val warn_selector : (int * [ `Enable | `Disable | `EnableError ]) list Cmdliner.Arg.conv

Warnings string "+3..10-4@12"

val opamlist_columns : OpamListCommand.output_format list Cmdliner.Arg.conv

Subcommands

type 'a subcommand = validity * string * 'a * string list * string

A subcommand cmds, v, args, doc is the subcommand cmd, using the documentation doc and the list of documentation parameters args. If the subcommand is selected, return v value.

type 'a subcommands = 'a subcommand list
val mk_subcommands : cli:OpamCLIVersion.Sourced.t -> 'a subcommands -> 'a option Cmdliner.Term.t * string list Cmdliner.Term.t

subcommands cmds are the terms cmd and params. cmd parses which sub-commands in cmds is selected and params parses the remaining of the command-line parameters as a list of strings.

type 'a default = [> `default of string ] as 'a
val mk_subcommands_with_default : cli:OpamCLIVersion.Sourced.t -> 'a default subcommands -> 'a option Cmdliner.Term.t * string list Cmdliner.Term.t

Same as mk_subcommand but use the default value if no sub-command is selected.

val bad_subcommand : cli:OpamCLIVersion.Sourced.t -> 'a default subcommands -> (string * 'a option * string list) -> 'b Cmdliner.Term.ret

bad_subcommand cmds cmd is a command return value denoting a parsing error of sub-commands.

val mk_subdoc : cli:OpamCLIVersion.Sourced.t -> ?defaults:(string * string) list -> ?extra_defaults:(validity * string * string) list -> 'a subcommands -> Cmdliner.Manpage.block list

mk_subdoc cmds is the documentation block for cmds.

val make_command_alias : cli:OpamCLIVersion.Sourced.t -> ('a Cmdliner.Term.t * Cmdliner.Cmd.info) -> ?options:string -> string -> 'a Cmdliner.Term.t * Cmdliner.Cmd.info

Create an alias for an existing command. options can be used to add extra options after the original command in the doc (eg like `unpin` is an alias for `pin remove`).

Commands

type command = unit Cmdliner.Term.t * Cmdliner.Cmd.info
val mk_command : cli:OpamCLIVersion.Sourced.t -> validity -> string -> doc:string -> man:Cmdliner.Manpage.block list -> (unit -> unit) Cmdliner.Term.t -> command
val mk_command_ret : cli:OpamCLIVersion.Sourced.t -> validity -> string -> doc:string -> man:Cmdliner.Manpage.block list -> (unit -> unit Cmdliner.Term.ret) Cmdliner.Term.t -> command

Documentation

val global_option_section : string
val help_sections : OpamCLIVersion.Sourced.t -> Cmdliner.Manpage.block list

Environment variables

val preinit_opam_env_variables : unit -> unit
val init_opam_env_variabes : OpamCLIVersion.Sourced.t -> unit
val scrubbed_environment_variables : string list
OCaml

Innovation. Community. Security.