Module IBase.CommandLineOption
val warnf : ('a, Stdlib.Format.formatter, unit) IStdlib.IStd.format -> 'aPrint to stderr in case of error, fails in strict mode
type parse_mode=|InferCommandparse arguments as arguments for infer
|Javacparse arguments passed to the Java compiler
|NoParseall arguments are anonymous arguments, no parsing is attempted
val compare_parse_mode : parse_mode -> parse_mode -> int
type 'a t= ?deprecated:string list -> long:string -> ?short:char -> ?parse_mode:parse_mode -> ?in_help:(ATDGenerated.InferCommand.t * string) list -> ?meta:string -> string -> 'aThe
mk_*functions declare command line options, whileparseparses then according to the declared options.The arguments of the declaration functions are largely treated uniformly:
longdeclares the option--longshortdeclares the option-shortas an aliasdeprecateddeclares the option-keyas an alias, for eachkeyindeprecateddefaultspecifies the default valuedefault_to_stringis used to document the default valuefspecifies a transformation to be performed on the parsed value before setting the config variablesymbolsis an association list sometimes used in place offparse_modedeclares which parse mode the option is forin_helpindicates the man pages in which the command should be documented, as generated by calling infer with --help. Otherwise it appears only in --help-full.metais a meta-variable naming the parsed value for documentation purposes- a documentation string
val mk_set : 'a IStdlib.IStd.ref -> 'a -> unit tmk_set variable valuedefines a command line option which setsvariabletovalue.
val mk_bool : ?deprecated_no:string list -> ?default:bool -> ?f:(bool -> bool) -> bool IStdlib.IStd.ref tmk_bool long short docdefines abool refset by the command line flag--long(and-s), and cleared by the flag--no-long(and-S). Iflongalready has a "no-" prefix, orsis capital, then the existing prefixes will instead be removed. The default value isfalseunless overridden by~default:true. Thedocstring will be prefixed with either "Activates:" or "Deactivates:", so should be phrased accordingly.
val mk_bool_group : ?deprecated_no:string list -> ?default:bool -> ?f:(bool -> bool) -> (bool IStdlib.IStd.ref list -> bool IStdlib.IStd.ref list -> bool IStdlib.IStd.ref) tmk_bool_group children not_childrenbehaves asmk_boolwith the addition that all thechildrenare also set and theno_childrenare unset. A child can be unset by including "--no-child" later in the arguments.
val mk_int : default:int -> ?default_to_string:(int -> string) -> ?f:(int -> int) -> int IStdlib.IStd.ref tval mk_int_opt : ?default:int -> ?default_to_string:(int option -> string) -> ?f:(int -> int) -> int option IStdlib.IStd.ref tval mk_float_opt : ?default:float -> ?default_to_string:(float option -> string) -> float option IStdlib.IStd.ref tval mk_string : default:string -> ?default_to_string:(string -> string) -> ?f:(string -> string) -> string IStdlib.IStd.ref tval mk_string_opt : ?default:string -> ?default_to_string:(string option -> string) -> ?f:(string -> string) -> ?mk_reset:bool -> string option IStdlib.IStd.ref tAn option "--
long-reset" is automatically created that resets the reference to None when found on the command line, unlessmk_resetis false.
val mk_string_list : ?default:string list -> ?default_to_string:(string list -> string) -> ?f:(string -> string) -> string list IStdlib.IStd.ref tmk_string_listdefines astring list ref, initialized to[]unless overridden by~default. Each argument of an occurrence of the option will be prepended to the list, so the final value will be in the reverse order they appeared on the command line.An option "--
long-reset" is automatically created that resets the list towhen found on the command line.
val mk_string_map : ?default:string IStdlib.IStd.String.Map.t -> ?default_to_string:(string IStdlib.IStd.String.Map.t -> string) -> string IStdlib.IStd.String.Map.t IStdlib.IStd.ref tval mk_path : default:string -> ?default_to_string:(string -> string) -> ?f:(string -> string) -> string IStdlib.IStd.ref tlike
mk_stringbut will resolve the string into an absolute path so that children processes agree on the absolute path that the option represents
val mk_path_opt : ?default:string -> ?default_to_string:(string option -> string) -> string option IStdlib.IStd.ref tanalogous of
mk_string_optwith the extra feature ofmk_path
val mk_path_list : ?default:string list -> ?default_to_string:(string list -> string) -> string list IStdlib.IStd.ref tanalogous of
mk_string_listwith the extra feature ofmk_path
val mk_symbol : default:'a -> symbols:(string * 'a) list -> eq:('a -> 'a -> bool) -> ?f:('a -> 'a) -> 'a IStdlib.IStd.ref tmk_symbol long symbolsdefines a command line flag--long <symbol>where(<symbol>,_)is an element ofsymbols.
val mk_symbol_opt : symbols:(string * 'a) list -> ?f:('a -> 'a) -> ?mk_reset:bool -> 'a option IStdlib.IStd.ref tmk_symbol_optis similar tomk_symbolbut defaults toNone. Ifmk_resetis false then do not create an additional --long-reset option to reset the value of the option toNone.
val mk_symbol_seq : ?default:'a list -> symbols:(string * 'a) list -> eq:('a -> 'a -> bool) -> 'a list IStdlib.IStd.ref tmk_symbol_seq long symbolsdefines a command line flag--long <symbol sequence>where<symbol sequence>is a comma-separated sequence of<symbol>s such that(<symbol>,_)is an element ofsymbols.
val mk_json : Yojson.Basic.t IStdlib.IStd.ref tval mk_anon : unit -> string list IStdlib.IStd.refmk_anon ()defines astring list refof the anonymous command line arguments, in the reverse order they appeared on the command line.
val mk_rest_actions : ?parse_mode:parse_mode -> ?in_help:(ATDGenerated.InferCommand.t * string) list -> string -> usage:string -> (string -> parse_mode) -> string list IStdlib.IStd.refmk_rest_actions doc ~usage command_to_parse_modedefines astring list refof the command line arguments following"--", in the reverse order they appeared on the command line.usageis the usage message in case of parse errors or if --help is passed. For example, callingmk_actionand parsingexe -opt1 -opt2 -- arg1 arg2will result in the returned ref containingarg2; arg1. Additionally, the first arg following"--"is passed tocommand_to_parse_modeto obtain the parse action that will be used to parse the remaining arguments.
val mk_command_doc : title:string -> section:int -> version:string -> date:string -> short_description:string -> synopsis:Cmdliner.Manpage.block list -> description:Cmdliner.Manpage.block list -> ?options:[ `Prepend of Cmdliner.Manpage.block list | `Replace of Cmdliner.Manpage.block list ] -> ?exit_status:Cmdliner.Manpage.block list -> ?environment:Cmdliner.Manpage.block list -> ?files:Cmdliner.Manpage.block list -> ?notes:Cmdliner.Manpage.block list -> ?bugs:Cmdliner.Manpage.block list -> ?examples:Cmdliner.Manpage.block list -> ?see_also:Cmdliner.Manpage.block list -> string -> command_docmk_command_doc ~title ~section ~version ~short_description ~synopsis ~description ~see_also command_exerecords information about a command that is used to create its man page. A lot of the concepts are taken from man-pages(7).command_exeis the name of the command, preferably an executable that selects the commandtitlewill be the title of the manualsectionwill be the section of the manual (the number 7 in man-pages(7))versionis the version string of the commanddateis the date of the last modification of the manualshort_descriptionis a one-line description of the commandoptionscan be either`Replace blocks, which populates the OPTIONS section withblocks, or`Prepend blocks, in which case the options from the command are used, prepended byblocks. If unspecified it defaults to`Prepend [].- All the other
section_nameoptions correspond to the contents of the sectionsection_name. Some are mandatory and some are not.
val mk_subcommand : ATDGenerated.InferCommand.t -> ?on_unknown_arg:[ `Add | `Skip | `Reject ] -> name:string -> ?deprecated_long:string -> ?parse_mode:parse_mode -> ?in_help:(ATDGenerated.InferCommand.t * string) list -> command_doc option -> unitmk_subcommand command ~long command_docdefines the subcommandcommand. A subcommand is activated by passingname, and by passing--deprecated_longif specified. A man page is automatically generated forcommandbased on the information incommand_doc, if available (otherwise the command is considered internal).on_unknown_argis the action taken on unknown anonymous arguments; it is `Reject by default.
val strict_mode : boolval strict_mode_env_var : stringval env_var_sep : charseparator of argv elements when encoded into environment variables
val extend_env_args : string list -> unitextend_env_args argsappendsargsto those passed viaargs_env_var
val parse : ?config_file:string -> usage:IStdlib.IStd.Arg.usage_msg -> parse_mode -> ATDGenerated.InferCommand.t option -> ATDGenerated.InferCommand.t option * (int -> 'a)parse ~usage parse_mode commandparses command line arguments as specified by preceding calls to themk_*functions, and returns:- the command selected by the user on the command line, except if
commandis not None in which case it is considered "pre-selected" for the user; - a function that prints the usage message and help text then exits with the code passed as argument.
The decoded values of the inferconfig file
config_file, if provided, are parsed, followed by the decoded values of the environment variableargs_env_var, followed bySys.argvifparse_modeis one that should parse command line arguments (this is defined in the implementation of this module). Therefore arguments passed on the command line supersede those specified in the environment variable, which themselves supersede those passed via the config file.WARNING: An argument will be interpreted as many times as it appears in all of the config file, the environment variable, and the command line. The
args_env_varis set to the set of options parsed inargs_env_varand on the command line.- the command selected by the user on the command line, except if
val show_manual : ?scrub_defaults:bool -> ?internal_section:string -> Cmdliner.Manpage.format -> command_doc -> ATDGenerated.InferCommand.t option -> unitDisplay the manual of
commandto the user, orcommand_docifcommandis None.formatis used as forCmdliner.Manpage.print. Ifinternal_sectionis specified, add a section titledinternal_sectionabout internal (hidden) options. Ifscrub_defaultsthen do not print default values for options.
val keep_args_file : bool IStdlib.IStd.ref