mirror of
https://github.com/c-cube/linol.git
synced 2025-12-06 03:05:31 -05:00
65 lines
26 KiB
HTML
65 lines
26 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Cmd (cmdliner.Cmdliner.Cmd)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 2.4.2"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> – <a href="../../index.html">cmdliner</a> » <a href="../index.html">Cmdliner</a> » Cmd</nav><header class="odoc-preamble"><h1>Module <code><span>Cmdliner.Cmd</span></code></h1><p>Commands.</p><p>Command line syntaxes are implicitely defined by <a href="../Term/index.html"><code>Term</code></a>s. A command value binds a syntax and its documentation to a command name.</p><p>A command can group a list of sub commands (and recursively). In this case your tool defines a tree of commands, each with its own command line syntax. The root of that tree is called the <em>main command</em>; it represents your tool and its name.</p></header><nav class="odoc-toc"><ul><li><a href="#info">Command information</a></li><li><a href="#cmds">Commands</a></li><li><a href="#eval">Evaluation</a><ul><li><a href="#eval_low">Low level evaluation</a></li></ul></li></ul></nav><div class="odoc-content"><h2 id="info"><a href="#info" class="anchor"></a>Command information</h2><p>Command information defines the name and documentation of a command.</p><div class="odoc-spec"><div class="spec module anchored" id="module-Exit"><a href="#module-Exit" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Exit/index.html">Exit</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Exit codes and their information.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Env"><a href="#module-Env" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Env/index.html">Env</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div><div class="spec-doc"><p>Environment variable and their information.</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-info"><a href="#type-info" class="anchor"></a><code><span><span class="keyword">type</span> info</span></code></div><div class="spec-doc"><p>The type for information about commands.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-info"><a href="#val-info" class="anchor"></a><code><span><span class="keyword">val</span> info :
|
||
<span><span class="optlabel">?deprecated</span>:string <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?man_xrefs</span>:<span><a href="../Manpage/index.html#type-xref">Manpage.xref</a> list</span> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?man</span>:<span><a href="../Manpage/index.html#type-block">Manpage.block</a> list</span> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?envs</span>:<span><a href="Env/index.html#type-info">Env.info</a> list</span> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?exits</span>:<span><a href="Exit/index.html#type-info">Exit.info</a> list</span> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?sdocs</span>:string <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?docs</span>:string <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?doc</span>:string <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?version</span>:string <span class="arrow">-></span></span>
|
||
<span>string <span class="arrow">-></span></span>
|
||
<a href="#type-info">info</a></span></code></div><div class="spec-doc"><p><code>info ?sdocs ?man ?docs ?doc ?version name</code> is a term information such that:</p><ul><li><code>name</code> is the name of the command.</li><li><code>version</code> is the version string of the command line tool, this is only relevant for the main command and ignored otherwise.</li><li><code>deprecated</code>, if specified the command is deprecated and the string is a message output on standard error when the command is used.</li><li><code>doc</code> is a one line description of the command used for the <code>NAME</code> section of the command's man page and in command group listings.</li><li><code>docs</code>, for commands that are part of a group, the title of the section of the parent's command man page where it should be listed (defaults to <a href="../Manpage/index.html#val-s_commands"><code>Manpage.s_commands</code></a>).</li><li><code>sdocs</code> defines the title of the section in which the standard <code>--help</code> and <code>--version</code> arguments are listed (defaults to <a href="../Manpage/index.html#val-s_common_options"><code>Manpage.s_common_options</code></a>).</li><li><code>exits</code> is a list of exit statuses that the command evaluation may produce, defaults to <a href="Exit/index.html#val-defaults"><code>Exit.defaults</code></a>.</li><li><code>envs</code> is a list of environment variables that influence the command's evaluation.</li><li><code>man</code> is the text of the man page for the command.</li><li><code>man_xrefs</code> are cross-references to other manual pages. These are used to generate a <a href="../Manpage/index.html#val-s_see_also"><code>Manpage.s_see_also</code></a> section.</li></ul><p><code>doc</code>, <code>man</code>, <code>envs</code> support the <a href="../../tool_man.html#doclang" title="doclang">documentation markup language</a> in which the following variables are recognized:</p><ul><li><code>$(tname)</code> the (term's) command's name.</li><li><code>$(mname)</code> the main command name.</li><li><code>$(iname)</code> the command invocation from main command to the command name.</li></ul></div></div><h2 id="cmds"><a href="#cmds" class="anchor"></a>Commands</h2><div class="odoc-spec"><div class="spec type anchored" id="type-t"><a href="#type-t" class="anchor"></a><code><span><span class="keyword">type</span> <span>'a t</span></span></code></div><div class="spec-doc"><p>The type for commands whose evaluation result in a value of type <code>'a</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-v"><a href="#val-v" class="anchor"></a><code><span><span class="keyword">val</span> v : <span><a href="#type-info">info</a> <span class="arrow">-></span></span> <span><span><span class="type-var">'a</span> <a href="../Term/index.html#type-t">Term.t</a></span> <span class="arrow">-></span></span> <span><span class="type-var">'a</span> <a href="#type-t">t</a></span></span></code></div><div class="spec-doc"><p><code>v i t</code> is a command with information <code>i</code> and command line syntax parsed by <code>t</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-group"><a href="#val-group" class="anchor"></a><code><span><span class="keyword">val</span> group : <span><span class="optlabel">?default</span>:<span><span class="type-var">'a</span> <a href="../Term/index.html#type-t">Term.t</a></span> <span class="arrow">-></span></span> <span><a href="#type-info">info</a> <span class="arrow">-></span></span> <span><span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> list</span> <span class="arrow">-></span></span> <span><span class="type-var">'a</span> <a href="#type-t">t</a></span></span></code></div><div class="spec-doc"><p><code>group i ?default cmds</code> is a command with information <code>i</code> that groups sub commands <code>cmds</code>. <code>default</code> is the command line syntax to parse if no sub command is specified on the command line. If <code>default</code> is <code>None</code> (default), the tool errors when no sub command is specified.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-name"><a href="#val-name" class="anchor"></a><code><span><span class="keyword">val</span> name : <span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span> string</span></code></div><div class="spec-doc"><p><code>name c</code> is the name of <code>c</code>.</p></div></div><h2 id="eval"><a href="#eval" class="anchor"></a>Evaluation</h2><p>These functions are meant to be composed with <a href="../../../ocaml/Stdlib/index.html#val-exit"><code>Stdlib.exit</code></a>. The following exit codes may be returned by all these functions:</p><ul><li><a href="Exit/index.html#val-cli_error"><code>Exit.cli_error</code></a> if a parse error occurs.</li><li><a href="Exit/index.html#val-internal_error"><code>Exit.internal_error</code></a> if the <code>~catch</code> argument is <code>true</code> (default) and an uncaught exception is raised.</li><li>The value of <code>~term_err</code> (defaults to <a href="Exit/index.html#val-cli_error"><code>Exit.cli_error</code></a>) if a term error occurs.</li></ul><p>These exit codes are described in <a href="Exit/index.html#val-defaults"><code>Exit.defaults</code></a> which is the default value of the <code>?exits</code> argument of function <a href="#val-info"><code>info</code></a>.</p><div class="odoc-spec"><div class="spec value anchored" id="val-eval"><a href="#val-eval" class="anchor"></a><code><span><span class="keyword">val</span> eval :
|
||
<span><span class="optlabel">?help</span>:<a href="../../../ocaml/Stdlib/Format/index.html#type-formatter">Stdlib.Format.formatter</a> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?err</span>:<a href="../../../ocaml/Stdlib/Format/index.html#type-formatter">Stdlib.Format.formatter</a> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?catch</span>:bool <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?env</span>:<span>(<span>string <span class="arrow">-></span></span> <span>string option</span>)</span> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?argv</span>:<span>string array</span> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?term_err</span>:<a href="Exit/index.html#type-code">Exit.code</a> <span class="arrow">-></span></span>
|
||
<span><span>unit <a href="#type-t">t</a></span> <span class="arrow">-></span></span>
|
||
<a href="Exit/index.html#type-code">Exit.code</a></span></code></div><div class="spec-doc"><p><code>eval cmd</code> is <a href="Exit/index.html#val-ok"><code>Exit.ok</code></a> if <code>cmd</code> evaluates to <code>()</code>. See <a href="#val-eval_value"><code>eval_value</code></a> for other arguments.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-eval'"><a href="#val-eval'" class="anchor"></a><code><span><span class="keyword">val</span> eval' :
|
||
<span><span class="optlabel">?help</span>:<a href="../../../ocaml/Stdlib/Format/index.html#type-formatter">Stdlib.Format.formatter</a> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?err</span>:<a href="../../../ocaml/Stdlib/Format/index.html#type-formatter">Stdlib.Format.formatter</a> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?catch</span>:bool <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?env</span>:<span>(<span>string <span class="arrow">-></span></span> <span>string option</span>)</span> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?argv</span>:<span>string array</span> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?term_err</span>:<a href="Exit/index.html#type-code">Exit.code</a> <span class="arrow">-></span></span>
|
||
<span><span><a href="Exit/index.html#type-code">Exit.code</a> <a href="#type-t">t</a></span> <span class="arrow">-></span></span>
|
||
<a href="Exit/index.html#type-code">Exit.code</a></span></code></div><div class="spec-doc"><p><code>eval' cmd</code> is <code>c</code> if <code>cmd</code> evaluates to the exit code <code>c</code>. See <a href="#val-eval_value"><code>eval_value</code></a> for other arguments.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-eval_result"><a href="#val-eval_result" class="anchor"></a><code><span><span class="keyword">val</span> eval_result :
|
||
<span><span class="optlabel">?help</span>:<a href="../../../ocaml/Stdlib/Format/index.html#type-formatter">Stdlib.Format.formatter</a> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?err</span>:<a href="../../../ocaml/Stdlib/Format/index.html#type-formatter">Stdlib.Format.formatter</a> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?catch</span>:bool <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?env</span>:<span>(<span>string <span class="arrow">-></span></span> <span>string option</span>)</span> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?argv</span>:<span>string array</span> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?term_err</span>:<a href="Exit/index.html#type-code">Exit.code</a> <span class="arrow">-></span></span>
|
||
<span><span><span><span>(unit, string)</span> <a href="../../../ocaml/Stdlib/index.html#type-result">result</a></span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span>
|
||
<a href="Exit/index.html#type-code">Exit.code</a></span></code></div><div class="spec-doc"><p><code>eval_result cmd</code> is:</p><ul><li><a href="Exit/index.html#val-ok"><code>Exit.ok</code></a> if <code>cmd</code> evaluates to <code>Ok ()</code>.</li><li><a href="Exit/index.html#val-some_error"><code>Exit.some_error</code></a> if <code>cmd</code> evaluates to <code>Error msg</code>. In this case <code>msg</code> is printed on <code>err</code>.</li></ul><p>See <a href="#val-eval_value"><code>eval_value</code></a> for other arguments.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-eval_result'"><a href="#val-eval_result'" class="anchor"></a><code><span><span class="keyword">val</span> eval_result' :
|
||
<span><span class="optlabel">?help</span>:<a href="../../../ocaml/Stdlib/Format/index.html#type-formatter">Stdlib.Format.formatter</a> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?err</span>:<a href="../../../ocaml/Stdlib/Format/index.html#type-formatter">Stdlib.Format.formatter</a> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?catch</span>:bool <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?env</span>:<span>(<span>string <span class="arrow">-></span></span> <span>string option</span>)</span> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?argv</span>:<span>string array</span> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?term_err</span>:<a href="Exit/index.html#type-code">Exit.code</a> <span class="arrow">-></span></span>
|
||
<span><span><span><span>(<a href="Exit/index.html#type-code">Exit.code</a>, string)</span> <a href="../../../ocaml/Stdlib/index.html#type-result">result</a></span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span>
|
||
<a href="Exit/index.html#type-code">Exit.code</a></span></code></div><div class="spec-doc"><p><code>eval_result' cmd</code> is:</p><ul><li><code>c</code> if <code>cmd</code> evaluates to <code>Ok c</code>.</li><li><a href="Exit/index.html#val-some_error"><code>Exit.some_error</code></a> if <code>cmd</code> evaluates to <code>Error msg</code>. In this case <code>msg</code> is printed on <code>err</code>.</li></ul><p>See <a href="#val-eval_value"><code>eval_value</code></a> for other arguments.</p></div></div><h3 id="eval_low"><a href="#eval_low" class="anchor"></a>Low level evaluation</h3><p>This interface gives more information on command evaluation results and lets you choose how to map evaluation results to exit codes.</p><div class="odoc-spec"><div class="spec type anchored" id="type-eval_ok"><a href="#type-eval_ok" class="anchor"></a><code><span><span class="keyword">type</span> <span>'a eval_ok</span></span><span> = </span><span>[ </span></code><ol><li id="type-eval_ok.Ok" class="def variant constructor anchored"><a href="#type-eval_ok.Ok" class="anchor"></a><code><span>| </span><span>`Ok <span class="keyword">of</span> <span class="type-var">'a</span></span></code><div class="def-doc"><span class="comment-delim">(*</span><p>The term of the command evaluated to this value.</p><span class="comment-delim">*)</span></div></li><li id="type-eval_ok.Version" class="def variant constructor anchored"><a href="#type-eval_ok.Version" class="anchor"></a><code><span>| </span><span>`Version</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>The version of the main cmd was requested.</p><span class="comment-delim">*)</span></div></li><li id="type-eval_ok.Help" class="def variant constructor anchored"><a href="#type-eval_ok.Help" class="anchor"></a><code><span>| </span><span>`Help</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>Help was requested.</p><span class="comment-delim">*)</span></div></li></ol><code><span> ]</span></code></div><div class="spec-doc"><p>The type for successful evaluation results.</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-eval_error"><a href="#type-eval_error" class="anchor"></a><code><span><span class="keyword">type</span> eval_error</span><span> = </span><span>[ </span></code><ol><li id="type-eval_error.Parse" class="def variant constructor anchored"><a href="#type-eval_error.Parse" class="anchor"></a><code><span>| </span><span>`Parse</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>A parse error occurred.</p><span class="comment-delim">*)</span></div></li><li id="type-eval_error.Term" class="def variant constructor anchored"><a href="#type-eval_error.Term" class="anchor"></a><code><span>| </span><span>`Term</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>A term evaluation error occurred.</p><span class="comment-delim">*)</span></div></li><li id="type-eval_error.Exn" class="def variant constructor anchored"><a href="#type-eval_error.Exn" class="anchor"></a><code><span>| </span><span>`Exn</span></code><div class="def-doc"><span class="comment-delim">(*</span><p>An uncaught exception occurred.</p><span class="comment-delim">*)</span></div></li></ol><code><span> ]</span></code></div><div class="spec-doc"><p>The type for erroring evaluation results.</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-eval_exit"><a href="#type-eval_exit" class="anchor"></a><code><span><span class="keyword">type</span> <span>'a eval_exit</span></span><span> = </span><span>[ </span></code><ol><li id="type-eval_exit.Ok" class="def variant constructor anchored"><a href="#type-eval_exit.Ok" class="anchor"></a><code><span>| </span><span>`Ok <span class="keyword">of</span> <span class="type-var">'a</span></span></code><div class="def-doc"><span class="comment-delim">(*</span><p>The term of the command evaluated to this value.</p><span class="comment-delim">*)</span></div></li><li id="type-eval_exit.Exit" class="def variant constructor anchored"><a href="#type-eval_exit.Exit" class="anchor"></a><code><span>| </span><span>`Exit <span class="keyword">of</span> <a href="Exit/index.html#type-code">Exit.code</a></span></code><div class="def-doc"><span class="comment-delim">(*</span><p>The evaluation wants to exit with this code.</p><span class="comment-delim">*)</span></div></li></ol><code><span> ]</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-eval_value"><a href="#val-eval_value" class="anchor"></a><code><span><span class="keyword">val</span> eval_value :
|
||
<span><span class="optlabel">?help</span>:<a href="../../../ocaml/Stdlib/Format/index.html#type-formatter">Stdlib.Format.formatter</a> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?err</span>:<a href="../../../ocaml/Stdlib/Format/index.html#type-formatter">Stdlib.Format.formatter</a> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?catch</span>:bool <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?env</span>:<span>(<span>string <span class="arrow">-></span></span> <span>string option</span>)</span> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?argv</span>:<span>string array</span> <span class="arrow">-></span></span>
|
||
<span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span>
|
||
<span><span>(<span><span class="type-var">'a</span> <a href="#type-eval_ok">eval_ok</a></span>, <a href="#type-eval_error">eval_error</a>)</span> <a href="../../../ocaml/Stdlib/index.html#type-result">result</a></span></span></code></div><div class="spec-doc"><p><code>eval ~help ~err ~catch ~env ~argv cmd</code> is the evaluation result of <code>cmd</code> with:</p><ul><li><code>argv</code> the command line arguments to parse (defaults to <code>Sys.argv</code>)</li><li><code>env</code> the function used for environment variable lookup (defaults to <code>Sys.getenv</code>).</li><li><code>catch</code> if <code>true</code> (default) uncaught exceptions are intercepted and their stack trace is written to the <code>err</code> formatter</li><li><code>help</code> is the formatter used to print help or version messages (defaults to <code>Format.std_formatter</code>)</li><li><code>err</code> is the formatter used to print error messages (defaults to <code>Format.err_formatter</code>).</li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-eval_value'"><a href="#val-eval_value'" class="anchor"></a><code><span><span class="keyword">val</span> eval_value' :
|
||
<span><span class="optlabel">?help</span>:<a href="../../../ocaml/Stdlib/Format/index.html#type-formatter">Stdlib.Format.formatter</a> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?err</span>:<a href="../../../ocaml/Stdlib/Format/index.html#type-formatter">Stdlib.Format.formatter</a> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?catch</span>:bool <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?env</span>:<span>(<span>string <span class="arrow">-></span></span> <span>string option</span>)</span> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?argv</span>:<span>string array</span> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?term_err</span>:int <span class="arrow">-></span></span>
|
||
<span><span><span class="type-var">'a</span> <a href="#type-t">t</a></span> <span class="arrow">-></span></span>
|
||
<span><span class="type-var">'a</span> <a href="#type-eval_exit">eval_exit</a></span></span></code></div><div class="spec-doc"><p><code>eval_value'</code> is like <a href="#val-eval_value"><code>eval_value</code></a>, but if the command term does not evaluate, returns an exit code like the <a href="#val-eval" title="eval">evaluation</a> function do (which can be <a href="Exit/index.html#val-ok"><code>Exit.ok</code></a> in case help or version was requested).</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-eval_peek_opts"><a href="#val-eval_peek_opts" class="anchor"></a><code><span><span class="keyword">val</span> eval_peek_opts :
|
||
<span><span class="optlabel">?version_opt</span>:bool <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?env</span>:<span>(<span>string <span class="arrow">-></span></span> <span>string option</span>)</span> <span class="arrow">-></span></span>
|
||
<span><span class="optlabel">?argv</span>:<span>string array</span> <span class="arrow">-></span></span>
|
||
<span><span><span class="type-var">'a</span> <a href="../Term/index.html#type-t">Term.t</a></span> <span class="arrow">-></span></span>
|
||
<span><span class="type-var">'a</span> option</span> * <span><span>(<span><span class="type-var">'a</span> <a href="#type-eval_ok">eval_ok</a></span>, <a href="#type-eval_error">eval_error</a>)</span> <a href="../../../ocaml/Stdlib/index.html#type-result">result</a></span></span></code></div><div class="spec-doc"><p><code>eval_peek_opts version_opt argv t</code> evaluates <code>t</code>, a term made of optional arguments only, with the command line <code>argv</code> (defaults to <code>Sys.argv</code>). In this evaluation, unknown optional arguments and positional arguments are ignored.</p><p>The evaluation returns a pair. The first component is the result of parsing the command line <code>argv</code> stripped from any help and version option if <code>version_opt</code> is <code>true</code> (defaults to <code>false</code>). It results in:</p><ul><li><code>Some _</code> if the command line would be parsed correctly given the <em>partial</em> knowledge in <code>t</code>.</li><li><code>None</code> if a parse error would occur on the options of <code>t</code></li></ul><p>The second component is the result of parsing the command line <code>argv</code> without stripping the help and version options. It indicates what the evaluation would result in on <code>argv</code> given the partial knowledge in <code>t</code> (for example it would return <code>`Help</code> if there's a help option in <code>argv</code>). However in contrasts to <a href="#val-eval_value"><code>eval_value</code></a> no side effects like error reporting or help output occurs.</p><p><b>Note.</b> Positional arguments can't be peeked without the full specification of the command line: we can't tell apart a positional argument from the value of an unknown optional argument.</p></div></div></div></body></html>
|