|
|
<!DOCTYPE html>
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>InferBase__CommandLineOption (InferBase.InferBase__CommandLineOption)</title><link rel="stylesheet" href="../../odoc.css"/><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><meta name="generator" content="doc-ock-html v1.0.0-1-g1fc9bf0"/></head><body><nav id="top"><a href="../index.html">Up</a> — <span class="package">package <a href="../index.html">InferBase</a></span></nav><header><h1><span class="keyword">Module</span> <span class="module-path">InferBase__CommandLineOption</span></h1></header><p>Definition and parsing of command line arguments</p><div class="spec val" id="val-warnf"><a href="#val-warnf" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>warnf : (<span class="type-var">'a</span>, Format.formatter, unit) <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.format <span class="keyword">‑></span> <span class="type-var">'a</span></code></div><div class="doc"><p>Print to stderr in case of error, fails in strict mode</p></div></div><div class="spec type" id="type-parse_mode"><a href="#type-parse_mode" class="anchor"></a><div class="def type"><code><span class="keyword">type </span>parse_mode</code><code></code><code><span class="keyword"> = </span></code><table class="variant"><tr id="type-parse_mode.InferCommand" class="anchored"><td class="def constructor"><a href="#type-parse_mode.InferCommand" class="anchor"></a><code><span class="keyword">| </span></code><code><span class="constructor">InferCommand</span></code></td><td class="doc"><p>(** parse arguments as arguments for infer *)</p></td></tr><tr id="type-parse_mode.Javac" class="anchored"><td class="def constructor"><a href="#type-parse_mode.Javac" class="anchor"></a><code><span class="keyword">| </span></code><code><span class="constructor">Javac</span></code></td><td class="doc"><p>(** parse arguments passed to the Java compiler *)</p></td></tr><tr id="type-parse_mode.NoParse" class="anchored"><td class="def constructor"><a href="#type-parse_mode.NoParse" class="anchor"></a><code><span class="keyword">| </span></code><code><span class="constructor">NoParse</span></code></td><td class="doc"><p>(** all arguments are anonymous arguments, no parsing is attempted *)</p></td></tr></table><code></code></div><div class="doc"></div></div><div class="spec include"><div class="doc"></div><details open="open"><summary><span class="def"><code><span class="keyword">include </span><span class="keyword">sig</span> ... <span class="keyword">end</span></code></span></summary><div class="spec val" id="val-compare_parse_mode"><a href="#val-compare_parse_mode" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>compare_parse_mode : <a href="index.html#type-parse_mode">parse_mode</a> <span class="keyword">‑></span> <a href="index.html#type-parse_mode">parse_mode</a> <span class="keyword">‑></span> int</code></div><div class="doc"></div></div></details></div><div class="spec val" id="val-is_originator"><a href="#val-is_originator" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>is_originator : bool</code></div><div class="doc"></div></div><div class="spec val" id="val-init_work_dir"><a href="#val-init_work_dir" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>init_work_dir : string</code></div><div class="doc"></div></div><div class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><div class="def type"><code><span class="keyword">type </span>'a t</code><code><span class="keyword"> = </span>?⁠deprecated:string list <span class="keyword">‑></span> long:string <span class="keyword">‑></span> ?⁠short:char <span class="keyword">‑></span> ?⁠parse_mode:<a href="index.html#type-parse_mode">parse_mode</a> <span class="keyword">‑></span> ?⁠in_help:(<a href="../../InferGenerated/InferGenerated/InferCommand/index.html#type-t">InferGenerated.InferCommand.t</a><span class="keyword"> * </span>string) list <span class="keyword">‑></span> ?⁠meta:string <span class="keyword">‑></span> string <span class="keyword">‑></span> <span class="type-var">'a</span></code><code></code></div><div class="doc"><p>The <code class="code">mk_*</code> functions declare command line options, while <code class="code">parse</code> parses then according to the
|
|
|
declared options.</p><p>The arguments of the declaration functions are largely treated uniformly:
|
|
|
</p><ul><li><code class="code">long</code> declares the option <code class="code">--long</code></li><li><code class="code">short</code> declares the option <code class="code">-short</code> as an alias</li><li><code class="code">deprecated</code> declares the option <code class="code">-key</code> as an alias, for each <code class="code">key</code> in <code class="code">deprecated</code></li><li><code class="code">default</code> specifies the default value</li><li><code class="code">default_to_string</code> is used to document the default value</li><li><code class="code">f</code> specifies a transformation to be performed on the parsed value before setting the config
|
|
|
variable</li><li><code class="code">symbols</code> is an association list sometimes used in place of <code class="code">f</code></li><li><code class="code">parse_mode</code> declares which parse mode the option is for</li><li><code class="code">in_help</code> indicates the man pages in which the command should be documented, as generated by
|
|
|
calling infer with --help. Otherwise it appears only in --help-full.</li><li><code class="code">meta</code> is a meta-variable naming the parsed value for documentation purposes</li><li>a documentation string</li></ul></div></div><div class="spec val" id="val-mk_set"><a href="#val-mk_set" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>mk_set : <span class="type-var">'a</span> <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref <span class="keyword">‑></span> <span class="type-var">'a</span> <span class="keyword">‑></span> unit <a href="index.html#type-t">t</a></code></div><div class="doc"><p><code class="code">mk_set variable value</code> defines a command line option which sets <code class="code">variable</code> to <code class="code">value</code>.</p></div></div><div class="spec val" id="val-mk_bool"><a href="#val-mk_bool" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>mk_bool : ?⁠deprecated_no:string list <span class="keyword">‑></span> ?⁠default:bool <span class="keyword">‑></span> ?⁠f:(bool <span class="keyword">‑></span> bool) <span class="keyword">‑></span> bool <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref <a href="index.html#type-t">t</a></code></div><div class="doc"><p><code class="code">mk_bool long short doc</code> defines a <code class="code">bool ref</code> set by the command line flag <code class="code">--long</code> (and
|
|
|
<code class="code">-s</code>), and cleared by the flag <code class="code">--no-long</code> (and <code class="code">-S</code>). If <code class="code">long</code> already has a "no-" prefix,
|
|
|
or <code class="code">s</code> is capital, then the existing prefixes will instead be removed. The default
|
|
|
value is <code class="code">false</code> unless overridden by <code class="code">~default:true</code>. The <code class="code">doc</code> string will be prefixed with
|
|
|
either "Activates:" or "Deactivates:", so should be phrased accordingly.</p></div></div><div class="spec val" id="val-mk_bool_group"><a href="#val-mk_bool_group" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>mk_bool_group : ?⁠deprecated_no:string list <span class="keyword">‑></span> ?⁠default:bool <span class="keyword">‑></span> ?⁠f:(bool <span class="keyword">‑></span> bool) <span class="keyword">‑></span> (bool <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref list <span class="keyword">‑></span> bool <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref list <span class="keyword">‑></span> bool <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref) <a href="index.html#type-t">t</a></code></div><div class="doc"><p><code class="code">mk_bool_group children not_children</code> behaves as <code class="code">mk_bool</code> with the addition that all the
|
|
|
<code class="code">children</code> are also set and the <code class="code">no_children</code> are unset. A child can be unset by including
|
|
|
"--no-child" later in the arguments.</p></div></div><div class="spec val" id="val-mk_int"><a href="#val-mk_int" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>mk_int : default:int <span class="keyword">‑></span> ?⁠f:(int <span class="keyword">‑></span> int) <span class="keyword">‑></span> int <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref <a href="index.html#type-t">t</a></code></div><div class="doc"></div></div><div class="spec val" id="val-mk_int_opt"><a href="#val-mk_int_opt" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>mk_int_opt : ?⁠default:int <span class="keyword">‑></span> ?⁠f:(int <span class="keyword">‑></span> int) <span class="keyword">‑></span> int option <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref <a href="index.html#type-t">t</a></code></div><div class="doc"></div></div><div class="spec val" id="val-mk_float_opt"><a href="#val-mk_float_opt" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>mk_float_opt : ?⁠default:float <span class="keyword">‑></span> float option <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref <a href="index.html#type-t">t</a></code></div><div class="doc"></div></div><div class="spec val" id="val-mk_string"><a href="#val-mk_string" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>mk_string : default:string <span class="keyword">‑></span> ?⁠f:(string <span class="keyword">‑></span> string) <span class="keyword">‑></span> string <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref <a href="index.html#type-t">t</a></code></div><div class="doc"></div></div><div class="spec val" id="val-mk_string_opt"><a href="#val-mk_string_opt" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>mk_string_opt : ?⁠default:string <span class="keyword">‑></span> ?⁠f:(string <span class="keyword">‑></span> string) <span class="keyword">‑></span> ?⁠mk_reset:bool <span class="keyword">‑></span> string option <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref <a href="index.html#type-t">t</a></code></div><div class="doc"><p>An option "--<code class="code">long</code>-reset" is automatically created that resets the reference to None when found
|
|
|
on the command line, unless <code class="code">mk_reset</code> is false.</p></div></div><div class="spec val" id="val-mk_string_list"><a href="#val-mk_string_list" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>mk_string_list : ?⁠default:string list <span class="keyword">‑></span> ?⁠f:(string <span class="keyword">‑></span> string) <span class="keyword">‑></span> string list <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref <a href="index.html#type-t">t</a></code></div><div class="doc"><p><code class="code">mk_string_list</code> defines a <code class="code">string list ref</code>, initialized to <code class="code">[]</code> unless overridden by
|
|
|
<code class="code">~default</code>. 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.</p><p>An option "--<code class="code">long</code>-reset" is automatically created that resets the list to <code class="code"></code> when found on the
|
|
|
command line.</p></div></div><div class="spec val" id="val-mk_path"><a href="#val-mk_path" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>mk_path : default:string <span class="keyword">‑></span> ?⁠f:(string <span class="keyword">‑></span> string) <span class="keyword">‑></span> string <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref <a href="index.html#type-t">t</a></code></div><div class="doc"><p>like <code class="code">mk_string</code> but will resolve the string into an absolute path so that children processes
|
|
|
agree on the absolute path that the option represents</p></div></div><div class="spec val" id="val-mk_path_opt"><a href="#val-mk_path_opt" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>mk_path_opt : ?⁠default:string <span class="keyword">‑></span> string option <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref <a href="index.html#type-t">t</a></code></div><div class="doc"><p>analogous of <code class="code">mk_string_opt</code> with the extra feature of <code class="code">mk_path</code></p></div></div><div class="spec val" id="val-mk_path_list"><a href="#val-mk_path_list" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>mk_path_list : ?⁠default:string list <span class="keyword">‑></span> string list <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref <a href="index.html#type-t">t</a></code></div><div class="doc"><p>analogous of <code class="code">mk_string_list</code> with the extra feature of <code class="code">mk_path</code></p></div></div><div class="spec val" id="val-mk_symbol"><a href="#val-mk_symbol" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>mk_symbol : default:<span class="type-var">'a</span> <span class="keyword">‑></span> symbols:(string<span class="keyword"> * </span><span class="type-var">'a</span>) list <span class="keyword">‑></span> eq:(<span class="type-var">'a</span> <span class="keyword">‑></span> <span class="type-var">'a</span> <span class="keyword">‑></span> bool) <span class="keyword">‑></span> ?⁠f:(<span class="type-var">'a</span> <span class="keyword">‑></span> <span class="type-var">'a</span>) <span class="keyword">‑></span> <span class="type-var">'a</span> <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref <a href="index.html#type-t">t</a></code></div><div class="doc"><p><code class="code">mk_symbol long symbols</code> defines a command line flag <code class="code">--long <symbol></code> where <code class="code">(<symbol>,_)</code> is
|
|
|
an element of <code class="code">symbols</code>.</p></div></div><div class="spec val" id="val-mk_symbol_opt"><a href="#val-mk_symbol_opt" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>mk_symbol_opt : symbols:(string<span class="keyword"> * </span><span class="type-var">'a</span>) list <span class="keyword">‑></span> ?⁠f:(<span class="type-var">'a</span> <span class="keyword">‑></span> <span class="type-var">'a</span>) <span class="keyword">‑></span> ?⁠mk_reset:bool <span class="keyword">‑></span> <span class="type-var">'a</span> option <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref <a href="index.html#type-t">t</a></code></div><div class="doc"><p><code class="code">mk_symbol_opt</code> is similar to <code class="code">mk_symbol</code> but defaults to <code class="code">None</code>. If <code class="code">mk_reset</code> is false then do not create an additional --<code class="code">long</code>-reset option to reset the value of the option to <code class="code">None</code>.</p></div></div><div class="spec val" id="val-mk_symbol_seq"><a href="#val-mk_symbol_seq" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>mk_symbol_seq : ?⁠default:<span class="type-var">'a</span> list <span class="keyword">‑></span> symbols:(string<span class="keyword"> * </span><span class="type-var">'a</span>) list <span class="keyword">‑></span> eq:(<span class="type-var">'a</span> <span class="keyword">‑></span> <span class="type-var">'a</span> <span class="keyword">‑></span> bool) <span class="keyword">‑></span> <span class="type-var">'a</span> list <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref <a href="index.html#type-t">t</a></code></div><div class="doc"><p><code class="code">mk_symbol_seq long symbols</code> defines a command line flag <code class="code">--long <symbol sequence></code> where
|
|
|
<code class="code"><symbol sequence></code> is a comma-separated sequence of <code class="code"><symbol></code>s such that <code class="code">(<symbol>,_)</code> is an
|
|
|
element of <code class="code">symbols</code>.</p></div></div><div class="spec val" id="val-mk_json"><a href="#val-mk_json" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>mk_json : Yojson.Basic.json <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref <a href="index.html#type-t">t</a></code></div><div class="doc"></div></div><div class="spec val" id="val-mk_anon"><a href="#val-mk_anon" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>mk_anon : unit <span class="keyword">‑></span> string list <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref</code></div><div class="doc"><p><code class="code">mk_anon ()</code> defines a <code class="code">string list ref</code> of the anonymous command line arguments, in the reverse
|
|
|
order they appeared on the command line.</p></div></div><div class="spec val" id="val-mk_rest_actions"><a href="#val-mk_rest_actions" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>mk_rest_actions : ?⁠parse_mode:<a href="index.html#type-parse_mode">parse_mode</a> <span class="keyword">‑></span> ?⁠in_help:(<a href="../../InferGenerated/InferGenerated/InferCommand/index.html#type-t">InferGenerated.InferCommand.t</a><span class="keyword"> * </span>string) list <span class="keyword">‑></span> string <span class="keyword">‑></span> usage:string <span class="keyword">‑></span> (string <span class="keyword">‑></span> <a href="index.html#type-parse_mode">parse_mode</a>) <span class="keyword">‑></span> string list <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref</code></div><div class="doc"><p><code class="code">mk_rest_actions doc ~usage command_to_parse_mode</code> defines a <code class="code">string list ref</code> of the command
|
|
|
line arguments following <code class="code">"--"</code>, in the reverse order they appeared on the command line. <code class="code">usage</code>
|
|
|
is the usage message in case of parse errors or if --help is passed. For example, calling
|
|
|
<code class="code">mk_action</code> and parsing <code class="code">exe -opt1 -opt2 -- arg1 arg2</code> will result in the returned ref
|
|
|
containing <code class="code">arg2; arg1</code>. Additionally, the first arg following <code class="code">"--"</code> is passed to
|
|
|
<code class="code">command_to_parse_mode</code> to obtain the parse action that will be used to parse the remaining
|
|
|
arguments.</p></div></div><div class="spec type" id="type-command_doc"><a href="#type-command_doc" class="anchor"></a><div class="def type"><code><span class="keyword">type </span>command_doc</code><code></code><code></code></div><div class="doc"></div></div><div class="spec val" id="val-mk_command_doc"><a href="#val-mk_command_doc" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>mk_command_doc : title:string <span class="keyword">‑></span> section:int <span class="keyword">‑></span> version:string <span class="keyword">‑></span> date:string <span class="keyword">‑></span> short_description:string <span class="keyword">‑></span> synopsis:Cmdliner.Manpage.block list <span class="keyword">‑></span> description:Cmdliner.Manpage.block list <span class="keyword">‑></span> ?⁠options:[ `Prepend of Cmdliner.Manpage.block list | `Replace of Cmdliner.Manpage.block list ] <span class="keyword">‑></span> ?⁠exit_status:Cmdliner.Manpage.block list <span class="keyword">‑></span> ?⁠environment:Cmdliner.Manpage.block list <span class="keyword">‑></span> ?⁠files:Cmdliner.Manpage.block list <span class="keyword">‑></span> ?⁠notes:Cmdliner.Manpage.block list <span class="keyword">‑></span> ?⁠bugs:Cmdliner.Manpage.block list <span class="keyword">‑></span> ?⁠examples:Cmdliner.Manpage.block list <span class="keyword">‑></span> see_also:Cmdliner.Manpage.block list <span class="keyword">‑></span> string <span class="keyword">‑></span> <a href="index.html#type-command_doc">command_doc</a></code></div><div class="doc"><p><code class="code">mk_command_doc ~title ~section ~version ~short_description ~synopsis ~description ~see_also
|
|
|
command_exe</code> records information about a command that is used to create its man page. A lot of
|
|
|
the concepts are taken from man-pages(7).</p><ul><li><code class="code">command_exe</code> is the name of the command, preferably an executable that selects the command</li><li><code class="code">title</code> will be the title of the manual</li><li><code class="code">section</code> will be the section of the manual (the number 7 in man-pages(7))</li><li><code class="code">version</code> is the version string of the command</li><li><code class="code">date</code> is the date of the last modification of the manual</li><li><code class="code">short_description</code> is a one-line description of the command</li><li><code class="code">options</code> can be either <code class="code">`Replace blocks</code>, which populates the OPTIONS section with <code class="code">blocks</code>,
|
|
|
or <code class="code">`Prepend blocks</code>, in which case the options from the command are used, prepended by
|
|
|
<code class="code">blocks</code>. If unspecified it defaults to <code class="code">`Prepend []</code>.</li><li>All the other <code class="code">section_name</code> options correspond to the contents of the section <code class="code">section_name</code>.
|
|
|
Some are mandatory and some are not.</li></ul></div></div><div class="spec val" id="val-mk_subcommand"><a href="#val-mk_subcommand" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>mk_subcommand : <a href="../../InferGenerated/InferGenerated/InferCommand/index.html#type-t">InferGenerated.InferCommand.t</a> <span class="keyword">‑></span> ?⁠on_unknown_arg:[ `Add | `Skip | `Reject ] <span class="keyword">‑></span> name:string <span class="keyword">‑></span> ?⁠deprecated_long:string <span class="keyword">‑></span> ?⁠parse_mode:<a href="index.html#type-parse_mode">parse_mode</a> <span class="keyword">‑></span> ?⁠in_help:(<a href="../../InferGenerated/InferGenerated/InferCommand/index.html#type-t">InferGenerated.InferCommand.t</a><span class="keyword"> * </span>string) list <span class="keyword">‑></span> <a href="index.html#type-command_doc">command_doc</a> option <span class="keyword">‑></span> unit</code></div><div class="doc"><p><code class="code">mk_subcommand command ~long command_doc</code> defines the subcommand <code class="code">command</code>. A subcommand is
|
|
|
activated by passing <code class="code">name</code>, and by passing <code class="code">--deprecated_long</code> if specified. A man page is
|
|
|
automatically generated for <code class="code">command</code> based on the information in <code class="code">command_doc</code>, if available
|
|
|
(otherwise the command is considered internal). <code class="code">on_unknown_arg</code> is the action taken on unknown
|
|
|
anonymous arguments; it is `Reject by default.</p></div></div><div class="spec val" id="val-args_env_var"><a href="#val-args_env_var" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>args_env_var : string</code></div><div class="doc"><p>environment variable use to pass arguments from parent to child processes</p></div></div><div class="spec val" id="val-strict_mode_env_var"><a href="#val-strict_mode_env_var" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>strict_mode_env_var : string</code></div><div class="doc"></div></div><div class="spec val" id="val-env_var_sep"><a href="#val-env_var_sep" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>env_var_sep : char</code></div><div class="doc"><p>separator of argv elements when encoded into environment variables</p></div></div><div class="spec val" id="val-extend_env_args"><a href="#val-extend_env_args" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>extend_env_args : string list <span class="keyword">‑></span> unit</code></div><div class="doc"><p><code class="code">extend_env_args args</code> appends <code class="code">args</code> to those passed via <code class="code">args_env_var</code></p></div></div><div class="spec val" id="val-parse"><a href="#val-parse" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>parse : ?⁠config_file:string <span class="keyword">‑></span> usage:<a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.Arg.usage_msg <span class="keyword">‑></span> <a href="index.html#type-parse_mode">parse_mode</a> <span class="keyword">‑></span> <a href="../../InferGenerated/InferGenerated/InferCommand/index.html#type-t">InferGenerated.InferCommand.t</a> option <span class="keyword">‑></span> <a href="../../InferGenerated/InferGenerated/InferCommand/index.html#type-t">InferGenerated.InferCommand.t</a> option<span class="keyword"> * </span>(int <span class="keyword">‑></span> <span class="type-var">'a</span>)</code></div><div class="doc"><p><code class="code">parse ~usage parse_mode command</code> parses command line arguments as specified by preceding calls
|
|
|
to the <code class="code">mk_*</code> functions, and returns:
|
|
|
</p><ul><li>the command selected by the user on the command line, except if <code class="code">command</code> is not None in which
|
|
|
case it is considered "pre-selected" for the user;</li><li>a function that prints the usage message and help text then exits with the code passed as
|
|
|
argument.</li></ul><p>The decoded values of the inferconfig file <code class="code">config_file</code>, if provided, are parsed, followed by
|
|
|
the decoded values of the environment variable <code class="code">args_env_var</code>, followed by <code class="code">Sys.argv</code> if
|
|
|
<code class="code">parse_mode</code> is 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.</p><p>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 <code class="code">args_env_var</code> is set to the set of options
|
|
|
parsed in <code class="code">args_env_var</code> and on the command line.</p></div></div><div class="spec val" id="val-is_env_var_set"><a href="#val-is_env_var_set" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>is_env_var_set : string <span class="keyword">‑></span> bool</code></div><div class="doc"><p><code class="code">is_env_var_set var</code> is true if $<code class="code">var</code>=1</p></div></div><div class="spec val" id="val-show_manual"><a href="#val-show_manual" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>show_manual : ?⁠internal_section:string <span class="keyword">‑></span> Cmdliner.Manpage.format <span class="keyword">‑></span> <a href="index.html#type-command_doc">command_doc</a> <span class="keyword">‑></span> <a href="../../InferGenerated/InferGenerated/InferCommand/index.html#type-t">InferGenerated.InferCommand.t</a> option <span class="keyword">‑></span> unit</code></div><div class="doc"><p>Display the manual of <code class="code">command</code> to the user, or <code class="code">command_doc</code> if <code class="code">command</code> is None. <code class="code">format</code> is
|
|
|
used as for <code class="code">Cmdliner.Manpage.print</code>. If <code class="code">internal_section</code> is specified, add a section titled
|
|
|
<code class="code">internal_section</code> about internal (hidden) options.</p></div></div><div class="spec val" id="val-keep_args_file"><a href="#val-keep_args_file" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>keep_args_file : bool <a href="../../InferStdlib/InferStdlib/index.html#module-IStd">InferStdlib.IStd</a>.ref</code></div><div class="doc"></div></div></body></html> |