package opam-client

  1. Overview
  2. Docs

Command-line argument parsers and helpers

Helpers and argument constructors

val mk_flag : ?section:string -> string list -> string -> bool Cmdliner.Term.t
val mk_opt : ?section:string -> ?vopt:'a -> string list -> string -> string -> 'a Cmdliner.Arg.converter -> 'a -> 'a Cmdliner.Term.t
val mk_opt_all : ?section:string -> ?vopt:'a -> ?default:'a list -> string list -> string -> string -> 'a Cmdliner.Arg.converter -> 'a list Cmdliner.Term.t

Flags

val print_short_flag : bool Cmdliner.Term.t

--short

val installed_roots_flag : bool Cmdliner.Term.t

--installed-root

val shell_opt : OpamTypes.shell Cmdliner.Term.t

--shell

val dot_profile_flag : OpamTypes.filename option Cmdliner.Term.t

--dot-profile

val repo_kind_flag : OpamUrl.backend option Cmdliner.Term.t

--http/ --git/ --local

val jobs_flag : int option Cmdliner.Term.t

--jobs

val pattern_list : string list Cmdliner.Term.t

patterns

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 arg_list : string -> string -> 'a Cmdliner.Arg.converter -> 'a list Cmdliner.Term.t

Generic argument list builder

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

Generic argument list builder

Global options

type global_options = {
  1. debug_level : int option;
  2. verbose : int;
  3. quiet : bool;
  4. color : [ `Always | `Never | `Auto ] option;
  5. opt_switch : string option;
  6. yes : bool;
  7. strict : bool;
  8. opt_root : OpamTypes.dirname option;
  9. no_base_packages : bool;
  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. safe_mode : bool;
  16. json : string option;
}

Type for global options

val global_options : global_options Cmdliner.Term.t

Global options

val create_global_options : bool -> bool -> int option -> 'a list -> bool -> [ `Always | `Auto | `Never ] option -> string option -> bool -> bool -> OpamTypes.dirname option -> bool -> string option -> bool -> string option -> string option -> bool -> string option -> global_options
val apply_global_options : global_options -> unit

Apply global options

Build options

type build_options

Abstract type for build options

val build_options : build_options Cmdliner.Term.t

Build options

val apply_build_options : build_options -> unit

Applly build options

Converters

val repository_name : OpamTypes.repository_name Cmdliner.Arg.converter

Repository name converter

val url : OpamTypes.url Cmdliner.Arg.converter

URL converter

val filename : OpamTypes.filename Cmdliner.Arg.converter

Filename converter

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

Filename converter also accepting "-" for stdin/stdout

val dirname : OpamTypes.dirname Cmdliner.Arg.converter

Dirnam converter

val existing_filename_dirname_or_dash : OpamFilename.generic_file option Cmdliner.Arg.converter
val package_name : OpamTypes.name Cmdliner.Arg.converter

Package name converter

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

name{.version}

val atom : OpamTypes.atom Cmdliner.Arg.converter

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

val warn_selector : (int * bool) list Cmdliner.Arg.converter

Warnings string "+3..10-4"

type 'a default = [> `default of string ] as 'a
val enum_with_default : (string * 'a default) list -> 'a Cmdliner.Arg.converter

Enumeration with a default command

val opamlist_column : OpamListCommand.output_format Cmdliner.Arg.converter

Subcommands

type 'a subcommand = 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.

type 'a subcommands = 'a subcommand list
val mk_subcommands : '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.

val mk_subcommands_with_default : '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 : '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 : ?defaults:(string * string) list -> 'a subcommands -> Cmdliner.Manpage.block list

mk_subdoc cmds is the documentation block for cmds.

Misc

Documentation

val global_option_section : string
val help_sections : Cmdliner.Manpage.block list
val term_info : string -> doc:string -> man:Cmdliner.Manpage.block list -> Cmdliner.Term.info
OCaml

Innovation. Community. Security.