ssw/doc/clap/struct.Arg.html
2023-01-09 19:23:20 +01:00

2043 lines
327 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="The abstract representation of a command line argument. Used to set all the options and relationships that define a valid argument for the program."><meta name="keywords" content="rust, rustlang, rust-lang, Arg"><title>Arg in clap - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../dark.css" disabled><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../clap/index.html"><div class="logo-container"><img src="https://raw.githubusercontent.com/clap-rs/clap/master/assets/clap.png" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../clap/index.html"><div class="logo-container">
<img src="https://raw.githubusercontent.com/clap-rs/clap/master/assets/clap.png" alt="logo"></div></a><h2 class="location"><a href="#">Arg</a></h2><div class="sidebar-elems"><section><div class="block"><h3 class="sidebar-title"><a href="#implementations">Methods</a></h3><ul><li><a href="#method.action">action</a></li><li><a href="#method.alias">alias</a></li><li><a href="#method.aliases">aliases</a></li><li><a href="#method.allow_hyphen_values">allow_hyphen_values</a></li><li><a href="#method.allow_negative_numbers">allow_negative_numbers</a></li><li><a href="#method.conflicts_with">conflicts_with</a></li><li><a href="#method.conflicts_with_all">conflicts_with_all</a></li><li><a href="#method.default_missing_value">default_missing_value</a></li><li><a href="#method.default_missing_value_os">default_missing_value_os</a></li><li><a href="#method.default_missing_values">default_missing_values</a></li><li><a href="#method.default_missing_values_os">default_missing_values_os</a></li><li><a href="#method.default_value">default_value</a></li><li><a href="#method.default_value_if">default_value_if</a></li><li><a href="#method.default_value_ifs">default_value_ifs</a></li><li><a href="#method.default_values">default_values</a></li><li><a href="#method.display_order">display_order</a></li><li><a href="#method.exclusive">exclusive</a></li><li><a href="#method.get_action">get_action</a></li><li><a href="#method.get_all_aliases">get_all_aliases</a></li><li><a href="#method.get_all_short_aliases">get_all_short_aliases</a></li><li><a href="#method.get_default_values">get_default_values</a></li><li><a href="#method.get_help">get_help</a></li><li><a href="#method.get_help_heading">get_help_heading</a></li><li><a href="#method.get_id">get_id</a></li><li><a href="#method.get_index">get_index</a></li><li><a href="#method.get_long">get_long</a></li><li><a href="#method.get_long_and_visible_aliases">get_long_and_visible_aliases</a></li><li><a href="#method.get_long_help">get_long_help</a></li><li><a href="#method.get_num_args">get_num_args</a></li><li><a href="#method.get_possible_values">get_possible_values</a></li><li><a href="#method.get_short">get_short</a></li><li><a href="#method.get_short_and_visible_aliases">get_short_and_visible_aliases</a></li><li><a href="#method.get_value_delimiter">get_value_delimiter</a></li><li><a href="#method.get_value_hint">get_value_hint</a></li><li><a href="#method.get_value_names">get_value_names</a></li><li><a href="#method.get_value_parser">get_value_parser</a></li><li><a href="#method.get_visible_aliases">get_visible_aliases</a></li><li><a href="#method.get_visible_short_aliases">get_visible_short_aliases</a></li><li><a href="#method.global">global</a></li><li><a href="#method.group">group</a></li><li><a href="#method.groups">groups</a></li><li><a href="#method.help">help</a></li><li><a href="#method.help_heading">help_heading</a></li><li><a href="#method.hide">hide</a></li><li><a href="#method.hide_default_value">hide_default_value</a></li><li><a href="#method.hide_long_help">hide_long_help</a></li><li><a href="#method.hide_possible_values">hide_possible_values</a></li><li><a href="#method.hide_short_help">hide_short_help</a></li><li><a href="#method.id">id</a></li><li><a href="#method.ignore_case">ignore_case</a></li><li><a href="#method.index">index</a></li><li><a href="#method.is_allow_hyphen_values_set">is_allow_hyphen_values_set</a></li><li><a href="#method.is_allow_negative_numbers_set">is_allow_negative_numbers_set</a></li><li><a href="#method.is_exclusive_set">is_exclusive_set</a></li><li><a href="#method.is_global_set">is_global_set</a></li><li><a href="#method.is_hide_default_value_set">is_hide_default_value_set</a></li><li><a href="#method.is_hide_long_help_set">is_hide_long_help_set</a></li><li><a href="#method.is_hide_possible_values_set">is_hide_possible_values_set</a></li><li><a href="#method.is_hide_set">is_hide_set</a></li><li><a href="#method.is_hide_short_help_set">is_hide_short_help_set</a></li><li><a href="#method.is_ignore_case_set">is_ignore_case_set</a></li><li><a href="#method.is_last_set">is_last_set</a></li><li><a href="#method.is_next_line_help_set">is_next_line_help_set</a></li><li><a href="#method.is_positional">is_positional</a></li><li><a href="#method.is_require_equals_set">is_require_equals_set</a></li><li><a href="#method.is_required_set">is_required_set</a></li><li><a href="#method.is_trailing_var_arg_set">is_trailing_var_arg_set</a></li><li><a href="#method.last">last</a></li><li><a href="#method.long">long</a></li><li><a href="#method.long_help">long_help</a></li><li><a href="#method.new">new</a></li><li><a href="#method.next_line_help">next_line_help</a></li><li><a href="#method.num_args">num_args</a></li><li><a href="#method.overrides_with">overrides_with</a></li><li><a href="#method.overrides_with_all">overrides_with_all</a></li><li><a href="#method.raw">raw</a></li><li><a href="#method.require_equals">require_equals</a></li><li><a href="#method.required">required</a></li><li><a href="#method.required_if_eq">required_if_eq</a></li><li><a href="#method.required_if_eq_all">required_if_eq_all</a></li><li><a href="#method.required_if_eq_any">required_if_eq_any</a></li><li><a href="#method.required_unless_present">required_unless_present</a></li><li><a href="#method.required_unless_present_all">required_unless_present_all</a></li><li><a href="#method.required_unless_present_any">required_unless_present_any</a></li><li><a href="#method.requires">requires</a></li><li><a href="#method.requires_if">requires_if</a></li><li><a href="#method.requires_ifs">requires_ifs</a></li><li><a href="#method.short">short</a></li><li><a href="#method.short_alias">short_alias</a></li><li><a href="#method.short_aliases">short_aliases</a></li><li><a href="#method.trailing_var_arg">trailing_var_arg</a></li><li><a href="#method.value_delimiter">value_delimiter</a></li><li><a href="#method.value_hint">value_hint</a></li><li><a href="#method.value_name">value_name</a></li><li><a href="#method.value_names">value_names</a></li><li><a href="#method.value_parser">value_parser</a></li><li><a href="#method.value_terminator">value_terminator</a></li><li><a href="#method.visible_alias">visible_alias</a></li><li><a href="#method.visible_aliases">visible_aliases</a></li><li><a href="#method.visible_short_alias">visible_short_alias</a></li><li><a href="#method.visible_short_aliases">visible_short_aliases</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#trait-implementations">Trait Implementations</a></h3><ul><li><a href="#impl-Clone-for-Arg">Clone</a></li><li><a href="#impl-Debug-for-Arg">Debug</a></li><li><a href="#impl-Default-for-Arg">Default</a></li><li><a href="#impl-Display-for-Arg">Display</a></li><li><a href="#impl-Eq-for-Arg">Eq</a></li><li><a href="#impl-From%3C%26Arg%3E-for-Arg">From&lt;&amp;Arg&gt;</a></li><li><a href="#impl-Ord-for-Arg">Ord</a></li><li><a href="#impl-PartialEq%3CArg%3E-for-Arg">PartialEq&lt;Arg&gt;</a></li><li><a href="#impl-PartialOrd%3CArg%3E-for-Arg">PartialOrd&lt;Arg&gt;</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul><li><a href="#impl-RefUnwindSafe-for-Arg">!RefUnwindSafe</a></li><li><a href="#impl-Send-for-Arg">Send</a></li><li><a href="#impl-Sync-for-Arg">Sync</a></li><li><a href="#impl-Unpin-for-Arg">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Arg">!UnwindSafe</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#blanket-implementations">Blanket Implementations</a></h3><ul><li><a href="#impl-Any-for-Arg">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-Arg">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-Arg">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-From%3CT%3E-for-Arg">From&lt;T&gt;</a></li><li><a href="#impl-Into%3CU%3E-for-Arg">Into&lt;U&gt;</a></li><li><a href="#impl-ToOwned-for-Arg">ToOwned</a></li><li><a href="#impl-ToString-for-Arg">ToString</a></li><li><a href="#impl-TryFrom%3CU%3E-for-Arg">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-Arg">TryInto&lt;U&gt;</a></li></ul></div></section><h2 class="location"><a href="index.html">In clap</a></h2></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../clap/index.html">
<img src="https://raw.githubusercontent.com/clap-rs/clap/master/assets/clap.png" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav></div><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn"><span class="in-band">Struct <a href="index.html">clap</a>::<wbr><a class="struct" href="#">Arg</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/clap/builder/arg.rs.html#54-86">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="docblock item-decl"><pre class="rust struct"><code>pub struct Arg { /* private fields */ }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The abstract representation of a command line argument. Used to set all the options and
relationships that define a valid argument for the program.</p>
<p>There are two methods for constructing <a href="builder/struct.Arg.html" title="Arg"><code>Arg</code></a>s, using the builder pattern and setting options
manually, or using a usage string which is far less verbose but has fewer options. You can also
use a combination of the two methods to achieve the best of both worlds.</p>
<ul>
<li><a href="builder/struct.Arg.html#basic-api" title="crate::Arg">Basic API</a></li>
<li><a href="builder/struct.Arg.html#value-handling" title="crate::Arg">Value Handling</a></li>
<li><a href="builder/struct.Arg.html#help-1" title="crate::Arg">Help</a></li>
<li><a href="builder/struct.Arg.html#advanced-argument-relations" title="crate::Arg">Advanced Argument Relations</a></li>
<li><a href="builder/struct.Arg.html#reflection" title="crate::Arg">Reflection</a></li>
</ul>
<h2 id="examples"><a href="#examples">Examples</a></h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="comment">// Using the traditional builder pattern and setting each option manually</span>
<span class="kw">let</span> <span class="ident">cfg</span> <span class="op">=</span> <span class="ident">Arg::new</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">short</span>(<span class="string">&#39;c&#39;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">value_name</span>(<span class="string">&quot;FILE&quot;</span>)
.<span class="ident">help</span>(<span class="string">&quot;Provides a config file to myprog&quot;</span>);
<span class="comment">// Using a usage string (setting a similar argument to the one above)</span>
<span class="kw">let</span> <span class="ident">input</span> <span class="op">=</span> <span class="macro">arg!</span>(<span class="op">-</span><span class="ident">i</span> <span class="op">-</span><span class="op">-</span><span class="ident">input</span> <span class="op">&lt;</span><span class="ident">FILE</span><span class="op">&gt;</span> <span class="string">&quot;Provides an input file to the program&quot;</span>);</code></pre></div>
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><div id="implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Arg" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#89-848">source</a></span><a href="#impl-Arg" class="anchor"></a><h3 class="code-header in-band">impl <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h3></section></summary><div class="docblock"><h4 id="basic-api"><a href="#basic-api">Basic API</a></h4></div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.new" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#107-109">source</a></span><h4 class="code-header">pub fn <a href="#method.new" class="fnname">new</a>(id: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Id.html" title="struct clap::Id">Id</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Create a new <a href="builder/struct.Arg.html" title="Arg"><code>Arg</code></a> with a unique name.</p>
<p>The name is used to check whether or not the argument was used at
runtime, get values, set relationships with other args, etc..</p>
<p><strong>NOTE:</strong> In the case of arguments that take values (i.e. <a href="builder/struct.Arg.html#method.action"><code>Arg::action(ArgAction::Set)</code></a>)
and positional arguments (i.e. those without a preceding <code>-</code> or <code>--</code>) the name will also
be displayed when the user prints the usage/help information of the program.</p>
<h5 id="examples-1"><a href="#examples-1">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;config&quot;</span>)</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.id" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#115-118">source</a></span><h4 class="code-header">pub fn <a href="#method.id" class="fnname">id</a>(self, id: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Id.html" title="struct clap::Id">Id</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Set the identifier used for referencing this argument in the clap API.</p>
<p>See <a href="builder/struct.Arg.html#method.new" title="Arg::new"><code>Arg::new</code></a> for more details.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.short" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#165-173">source</a></span><h4 class="code-header">pub fn <a href="#method.short" class="fnname">short</a>(self, s: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.char.html">char</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Sets the short version of the argument without the preceding <code>-</code>.</p>
<p>By default <code>V</code> and <code>h</code> are used by the auto-generated <code>version</code> and <code>help</code> arguments,
respectively. You will need to disable the auto-generated flags
(<a href="builder/struct.Command.html#method.disable_help_flag" title="crate::Command::disable_help_flag"><code>disable_help_flag</code></a>,
<a href="builder/struct.Command.html#method.disable_version_flag" title="crate::Command::disable_version_flag"><code>disable_version_flag</code></a>) and define your own.</p>
<h5 id="examples-2"><a href="#examples-2">Examples</a></h5>
<p>When calling <code>short</code>, use a single valid UTF-8 character which will allow using the
argument via a single hyphen (<code>-</code>) such as <code>-c</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">short</span>(<span class="string">&#39;c&#39;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;-c&quot;</span>, <span class="string">&quot;file.toml&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;config&quot;</span>).<span class="ident">map</span>(<span class="ident">String::as_str</span>), <span class="prelude-val">Some</span>(<span class="string">&quot;file.toml&quot;</span>));</code></pre></div>
<p>To use <code>-h</code> for your own flag and still have help:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">disable_help_flag</span>(<span class="bool-val">true</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;host&quot;</span>)
.<span class="ident">short</span>(<span class="string">&#39;h&#39;</span>)
.<span class="ident">long</span>(<span class="string">&quot;host&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;help&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;help&quot;</span>)
.<span class="ident">global</span>(<span class="bool-val">true</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Help</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;-h&quot;</span>, <span class="string">&quot;wikipedia.org&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;host&quot;</span>).<span class="ident">map</span>(<span class="ident">String::as_str</span>), <span class="prelude-val">Some</span>(<span class="string">&quot;wikipedia.org&quot;</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.long" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#206-209">source</a></span><h4 class="code-header">pub fn <a href="#method.long" class="fnname">long</a>(self, l: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Sets the long version of the argument without the preceding <code>--</code>.</p>
<p>By default <code>version</code> and <code>help</code> are used by the auto-generated <code>version</code> and <code>help</code>
arguments, respectively. You may use the word <code>version</code> or <code>help</code> for the long form of your
own arguments, in which case <code>clap</code> simply will not assign those to the auto-generated
<code>version</code> or <code>help</code> arguments.</p>
<p><strong>NOTE:</strong> Any leading <code>-</code> characters will be stripped</p>
<h5 id="examples-3"><a href="#examples-3">Examples</a></h5>
<p>To set <code>long</code> use a word containing valid UTF-8. If you supply a double leading
<code>--</code> such as <code>--config</code> they will be stripped. Hyphens in the middle of the word, however,
will <em>not</em> be stripped (i.e. <code>config-file</code> is allowed).</p>
<p>Setting <code>long</code> allows using the argument via a double hyphen (<code>--</code>) such as <code>--config</code></p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--config&quot;</span>, <span class="string">&quot;file.toml&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;cfg&quot;</span>).<span class="ident">map</span>(<span class="ident">String::as_str</span>), <span class="prelude-val">Some</span>(<span class="string">&quot;file.toml&quot;</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.alias" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#231-238">source</a></span><h4 class="code-header">pub fn <a href="#method.alias" class="fnname">alias</a>(self, name: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Add an alias, which functions as a hidden long flag.</p>
<p>This is more efficient, and easier than creating multiple hidden arguments as one only
needs to check for the existence of this command, and not all variants.</p>
<h5 id="examples-4"><a href="#examples-4">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;test&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;test&quot;</span>)
.<span class="ident">alias</span>(<span class="string">&quot;alias&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--alias&quot;</span>, <span class="string">&quot;cool&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;test&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;cool&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.short_alias" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#260-268">source</a></span><h4 class="code-header">pub fn <a href="#method.short_alias" class="fnname">short_alias</a>(self, name: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.char.html">char</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Add an alias, which functions as a hidden short flag.</p>
<p>This is more efficient, and easier than creating multiple hidden arguments as one only
needs to check for the existence of this command, and not all variants.</p>
<h5 id="examples-5"><a href="#examples-5">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;test&quot;</span>)
.<span class="ident">short</span>(<span class="string">&#39;t&#39;</span>)
.<span class="ident">short_alias</span>(<span class="string">&#39;e&#39;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;-e&quot;</span>, <span class="string">&quot;cool&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;test&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;cool&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.aliases" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#292-296">source</a></span><h4 class="code-header">pub fn <a href="#method.aliases" class="fnname">aliases</a>(self, names: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Add aliases, which function as hidden long flags.</p>
<p>This is more efficient, and easier than creating multiple hidden subcommands as one only
needs to check for the existence of this command, and not all variants.</p>
<h5 id="examples-6"><a href="#examples-6">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;test&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;test&quot;</span>)
.<span class="ident">aliases</span>([<span class="string">&quot;do-stuff&quot;</span>, <span class="string">&quot;do-tests&quot;</span>, <span class="string">&quot;tests&quot;</span>])
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>)
.<span class="ident">help</span>(<span class="string">&quot;the file to add&quot;</span>)
.<span class="ident">required</span>(<span class="bool-val">false</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--do-tests&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span><span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">bool</span><span class="op">&gt;</span>(<span class="string">&quot;test&quot;</span>).<span class="ident">expect</span>(<span class="string">&quot;defaulted by clap&quot;</span>), <span class="bool-val">true</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.short_aliases" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#320-326">source</a></span><h4 class="code-header">pub fn <a href="#method.short_aliases" class="fnname">short_aliases</a>(self, names: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.char.html">char</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Add aliases, which functions as a hidden short flag.</p>
<p>This is more efficient, and easier than creating multiple hidden subcommands as one only
needs to check for the existence of this command, and not all variants.</p>
<h5 id="examples-7"><a href="#examples-7">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;test&quot;</span>)
.<span class="ident">short</span>(<span class="string">&#39;t&#39;</span>)
.<span class="ident">short_aliases</span>([<span class="string">&#39;e&#39;</span>, <span class="string">&#39;s&#39;</span>])
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>)
.<span class="ident">help</span>(<span class="string">&quot;the file to add&quot;</span>)
.<span class="ident">required</span>(<span class="bool-val">false</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;-s&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span><span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">bool</span><span class="op">&gt;</span>(<span class="string">&quot;test&quot;</span>).<span class="ident">expect</span>(<span class="string">&quot;defaulted by clap&quot;</span>), <span class="bool-val">true</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.visible_alias" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#348-355">source</a></span><h4 class="code-header">pub fn <a href="#method.visible_alias" class="fnname">visible_alias</a>(self, name: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Add an alias, which functions as a visible long flag.</p>
<p>Like <a href="builder/struct.Arg.html#method.alias" title="Arg::alias"><code>Arg::alias</code></a>, except that they are visible inside the help message.</p>
<h5 id="examples-8"><a href="#examples-8">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;test&quot;</span>)
.<span class="ident">visible_alias</span>(<span class="string">&quot;something-awesome&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;test&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--something-awesome&quot;</span>, <span class="string">&quot;coffee&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;test&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;coffee&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.visible_short_alias" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#376-384">source</a></span><h4 class="code-header">pub fn <a href="#method.visible_short_alias" class="fnname">visible_short_alias</a>(self, name: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.char.html">char</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Add an alias, which functions as a visible short flag.</p>
<p>Like <a href="builder/struct.Arg.html#method.short_alias" title="Arg::short_alias"><code>Arg::short_alias</code></a>, except that they are visible inside the help message.</p>
<h5 id="examples-9"><a href="#examples-9">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;test&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;test&quot;</span>)
.<span class="ident">visible_short_alias</span>(<span class="string">&#39;t&#39;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;-t&quot;</span>, <span class="string">&quot;coffee&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;test&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;coffee&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.visible_aliases" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#406-410">source</a></span><h4 class="code-header">pub fn <a href="#method.visible_aliases" class="fnname">visible_aliases</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;names: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;&gt;<br>) -&gt; Self</h4></section></summary><div class="docblock"><p>Add aliases, which function as visible long flags.</p>
<p>Like <a href="builder/struct.Arg.html#method.aliases" title="Arg::aliases"><code>Arg::aliases</code></a>, except that they are visible inside the help message.</p>
<h5 id="examples-10"><a href="#examples-10">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;test&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;test&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>)
.<span class="ident">visible_aliases</span>([<span class="string">&quot;something&quot;</span>, <span class="string">&quot;awesome&quot;</span>, <span class="string">&quot;cool&quot;</span>]))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--awesome&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span><span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">bool</span><span class="op">&gt;</span>(<span class="string">&quot;test&quot;</span>).<span class="ident">expect</span>(<span class="string">&quot;defaulted by clap&quot;</span>), <span class="bool-val">true</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.visible_short_aliases" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#431-437">source</a></span><h4 class="code-header">pub fn <a href="#method.visible_short_aliases" class="fnname">visible_short_aliases</a>(self, names: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.char.html">char</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Add aliases, which function as visible short flags.</p>
<p>Like <a href="builder/struct.Arg.html#method.short_aliases" title="Arg::short_aliases"><code>Arg::short_aliases</code></a>, except that they are visible inside the help message.</p>
<h5 id="examples-11"><a href="#examples-11">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;test&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;test&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>)
.<span class="ident">visible_short_aliases</span>([<span class="string">&#39;t&#39;</span>, <span class="string">&#39;e&#39;</span>]))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;-t&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span><span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">bool</span><span class="op">&gt;</span>(<span class="string">&quot;test&quot;</span>).<span class="ident">expect</span>(<span class="string">&quot;defaulted by clap&quot;</span>), <span class="bool-val">true</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.index" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#491-494">source</a></span><h4 class="code-header">pub fn <a href="#method.index" class="fnname">index</a>(self, idx: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.usize.html">usize</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Specifies the index of a positional argument <strong>starting at</strong> 1.</p>
<p><strong>NOTE:</strong> The index refers to position according to <strong>other positional argument</strong>. It does
not define position in the argument list as a whole.</p>
<p><strong>NOTE:</strong> You can optionally leave off the <code>index</code> method, and the index will be
assigned in order of evaluation. Utilizing the <code>index</code> method allows for setting
indexes out of order</p>
<p><strong>NOTE:</strong> This is only meant to be used for positional arguments and shouldnt to be used
with <a href="builder/struct.Arg.html#method.short"><code>Arg::short</code></a> or <a href="builder/struct.Arg.html#method.long"><code>Arg::long</code></a>.</p>
<p><strong>NOTE:</strong> When utilized with [<code>Arg::num_args(1..)</code>], only the <strong>last</strong> positional argument
may be defined as having a variable number of arguments (i.e. with the highest index)</p>
<h5 id="panics"><a href="#panics">Panics</a></h5>
<p><a href="builder/struct.Command.html"><code>Command</code></a> will <a href="https://doc.rust-lang.org/1.64.0/std/macro.panic.html" title="panic!"><code>panic!</code></a> if indexes are skipped (such as defining <code>index(1)</code> and <code>index(3)</code>
but not <code>index(2)</code>, or a positional argument is defined as multiple and is not the highest
index</p>
<h5 id="examples-12"><a href="#examples-12">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">index</span>(<span class="number">1</span>)</code></pre></div>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;mode&quot;</span>)
.<span class="ident">index</span>(<span class="number">1</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--debug&quot;</span>, <span class="string">&quot;fast&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">m</span>.<span class="ident">contains_id</span>(<span class="string">&quot;mode&quot;</span>));
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;mode&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;fast&quot;</span>); <span class="comment">// notice index(1) means &quot;first positional&quot;</span>
<span class="comment">// *not* first argument</span></code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.trailing_var_arg" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#519-525">source</a></span><h4 class="code-header">pub fn <a href="#method.trailing_var_arg" class="fnname">trailing_var_arg</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>This is a “VarArg” and everything that follows should be captured by it, as if the user had
used a <code>--</code>.</p>
<p><strong>NOTE:</strong> To start the trailing “VarArg” on unknown flags (and not just a positional
value), set <a href="builder/struct.Arg.html#method.allow_hyphen_values" title="Arg::allow_hyphen_values"><code>allow_hyphen_values</code></a>. Either way, users still
have the option to explicitly escape ambiguous arguments with <code>--</code>.</p>
<p><strong>NOTE:</strong> <a href="builder/struct.Arg.html#method.value_delimiter" title="Arg::value_delimiter"><code>Arg::value_delimiter</code></a> still applies if set.</p>
<p><strong>NOTE:</strong> Setting this requires <a href="builder/struct.Arg.html#method.num_args"><code>Arg::num_args(..)</code></a>.</p>
<h5 id="examples-13"><a href="#examples-13">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">arg</span>(<span class="macro">arg!</span>(<span class="op">&lt;</span><span class="ident">cmd</span><span class="op">&gt;</span> ... <span class="string">&quot;commands to run&quot;</span>).<span class="ident">trailing_var_arg</span>(<span class="bool-val">true</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[<span class="string">&quot;myprog&quot;</span>, <span class="string">&quot;arg1&quot;</span>, <span class="string">&quot;-r&quot;</span>, <span class="string">&quot;val1&quot;</span>]);
<span class="kw">let</span> <span class="ident">trail</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">m</span>.<span class="ident">get_many</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;cmd&quot;</span>).<span class="ident">unwrap</span>().<span class="ident">collect</span>();
<span class="macro">assert_eq!</span>(<span class="ident">trail</span>, [<span class="string">&quot;arg1&quot;</span>, <span class="string">&quot;-r&quot;</span>, <span class="string">&quot;val1&quot;</span>]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.last" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#605-611">source</a></span><h4 class="code-header">pub fn <a href="#method.last" class="fnname">last</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>This arg is the last, or final, positional argument (i.e. has the highest
index) and is <em>only</em> able to be accessed via the <code>--</code> syntax (i.e. <code>$ prog args -- last_arg</code>).</p>
<p>Even, if no other arguments are left to parse, if the user omits the <code>--</code> syntax
they will receive an <a href="error/enum.ErrorKind.html#variant.UnknownArgument"><code>UnknownArgument</code></a> error. Setting an argument to <code>.last(true)</code> also
allows one to access this arg early using the <code>--</code> syntax. Accessing an arg early, even with
the <code>--</code> syntax is otherwise not possible.</p>
<p><strong>NOTE:</strong> This will change the usage string to look like <code>$ prog [OPTIONS] [-- &lt;ARG&gt;]</code> if
<code>ARG</code> is marked as <code>.last(true)</code>.</p>
<p><strong>NOTE:</strong> This setting will imply <a href="builder/struct.Command.html#method.dont_collapse_args_in_usage" title="crate::Command::dont_collapse_args_in_usage"><code>crate::Command::dont_collapse_args_in_usage</code></a> because failing
to set this can make the usage string very confusing.</p>
<p><strong>NOTE</strong>: This setting only applies to positional arguments, and has no effect on OPTIONS</p>
<p><strong>NOTE:</strong> Setting this requires <a href="builder/struct.Arg.html#method.num_args" title="Arg::num_args">taking values</a></p>
<p><strong>CAUTION:</strong> Using this setting <em>and</em> having child subcommands is not
recommended with the exception of <em>also</em> using
<a href="builder/struct.Command.html#method.args_conflicts_with_subcommands" title="crate::Command::args_conflicts_with_subcommands"><code>crate::Command::args_conflicts_with_subcommands</code></a>
(or <a href="builder/struct.Command.html#method.subcommand_negates_reqs" title="crate::Command::subcommand_negates_reqs"><code>crate::Command::subcommand_negates_reqs</code></a> if the argument marked <code>Last</code> is also
marked <a href="builder/struct.Arg.html#method.required" title="Arg::required"><code>Arg::required</code></a>)</p>
<h5 id="examples-14"><a href="#examples-14">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;args&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">last</span>(<span class="bool-val">true</span>)</code></pre></div>
<p>Setting <code>last</code> ensures the arg has the highest <a href="builder/struct.Arg.html#method.index">index</a> of all positional args
and requires that the <code>--</code> syntax be used to access it early.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;first&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;second&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;third&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">last</span>(<span class="bool-val">true</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;one&quot;</span>, <span class="string">&quot;--&quot;</span>, <span class="string">&quot;three&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_ok</span>());
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">res</span>.<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;third&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;three&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;second&quot;</span>), <span class="prelude-val">None</span>);</code></pre></div>
<p>Even if the positional argument marked <code>Last</code> is the only argument left to parse,
failing to use the <code>--</code> syntax results in an error.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;first&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;second&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;third&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">last</span>(<span class="bool-val">true</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;one&quot;</span>, <span class="string">&quot;two&quot;</span>, <span class="string">&quot;three&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_err</span>());
<span class="macro">assert_eq!</span>(<span class="ident">res</span>.<span class="ident">unwrap_err</span>().<span class="ident">kind</span>(), <span class="ident">ErrorKind::UnknownArgument</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.required" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#668-674">source</a></span><h4 class="code-header">pub fn <a href="#method.required" class="fnname">required</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Specifies that the argument must be present.</p>
<p>Required by default means it is required, when no other conflicting rules or overrides have
been evaluated. Conflicting rules take precedence over being required.</p>
<p><strong>Pro tip:</strong> Flags (i.e. not positional, or arguments that take values) shouldnt be
required by default. This is because if a flag were to be required, it should simply be
implied. No additional information is required from user. Flags by their very nature are
simply boolean on/off switches. The only time a user <em>should</em> be required to use a flag
is if the operation is destructive in nature, and the user is essentially proving to you,
“Yes, I know what Im doing.”</p>
<h5 id="examples-15"><a href="#examples-15">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">required</span>(<span class="bool-val">true</span>)</code></pre></div>
<p>Setting required requires that the argument be used at runtime.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">required</span>(<span class="bool-val">true</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--config&quot;</span>, <span class="string">&quot;file.conf&quot;</span>,
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_ok</span>());</code></pre></div>
<p>Setting required and then <em>not</em> supplying that argument at runtime is an error.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">required</span>(<span class="bool-val">true</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_err</span>());
<span class="macro">assert_eq!</span>(<span class="ident">res</span>.<span class="ident">unwrap_err</span>().<span class="ident">kind</span>(), <span class="ident">ErrorKind::MissingRequiredArgument</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.requires" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#731-738">source</a></span><h4 class="code-header">pub fn <a href="#method.requires" class="fnname">requires</a>(self, arg_id: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.Id.html" title="struct clap::Id">Id</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Sets an argument that is required when this one is present</p>
<p>i.e. when using this argument, the following argument <em>must</em> be present.</p>
<p><strong>NOTE:</strong> <a href="builder/struct.Arg.html#method.conflicts_with">Conflicting</a> rules and <a href="builder/struct.Arg.html#method.overrides_with">override</a> rules take precedence over being required</p>
<h5 id="examples-16"><a href="#examples-16">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">requires</span>(<span class="string">&quot;input&quot;</span>)</code></pre></div>
<p>Setting <a href="builder/struct.Arg.html#method.requires"><code>Arg::requires(name)</code></a> requires that the argument be used at runtime if the
defining argument is used. If the defining argument isnt used, the other argument isnt
required</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">requires</span>(<span class="string">&quot;input&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;input&quot;</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_ok</span>()); <span class="comment">// We didn&#39;t use cfg, so input wasn&#39;t required</span></code></pre></div>
<p>Setting <a href="builder/struct.Arg.html#method.requires"><code>Arg::requires(name)</code></a> and <em>not</em> supplying that argument is an error.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">requires</span>(<span class="string">&quot;input&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;input&quot;</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--config&quot;</span>, <span class="string">&quot;file.conf&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_err</span>());
<span class="macro">assert_eq!</span>(<span class="ident">res</span>.<span class="ident">unwrap_err</span>().<span class="ident">kind</span>(), <span class="ident">ErrorKind::MissingRequiredArgument</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.exclusive" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#773-779">source</a></span><h4 class="code-header">pub fn <a href="#method.exclusive" class="fnname">exclusive</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>This argument must be passed alone; it conflicts with all other arguments.</p>
<h5 id="examples-17"><a href="#examples-17">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">exclusive</span>(<span class="bool-val">true</span>)</code></pre></div>
<p>Setting an exclusive argument and having any other arguments present at runtime
is an error.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;exclusive&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">exclusive</span>(<span class="bool-val">true</span>)
.<span class="ident">long</span>(<span class="string">&quot;exclusive&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;debug&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;input&quot;</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--exclusive&quot;</span>, <span class="string">&quot;file.conf&quot;</span>, <span class="string">&quot;file.txt&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_err</span>());
<span class="macro">assert_eq!</span>(<span class="ident">res</span>.<span class="ident">unwrap_err</span>().<span class="ident">kind</span>(), <span class="ident">ErrorKind::ArgumentConflict</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.global" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#816-822">source</a></span><h4 class="code-header">pub fn <a href="#method.global" class="fnname">global</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Specifies that an argument can be matched to all child <a href="trait.Subcommand.html"><code>Subcommand</code></a>s.</p>
<p><strong>NOTE:</strong> Global arguments <em>only</em> propagate down, <strong>not</strong> up (to parent commands), however
their values once a user uses them will be propagated back up to parents. In effect, this
means one should <em>define</em> all global arguments at the top level, however it doesnt matter
where the user <em>uses</em> the global argument.</p>
<h5 id="examples-18"><a href="#examples-18">Examples</a></h5>
<p>Assume an application with two subcommands, and youd like to define a
<code>--verbose</code> flag that can be called on any of the subcommands and parent, but you dont
want to clutter the source with three duplicate <a href="builder/struct.Arg.html" title="Arg"><code>Arg</code></a> definitions.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;verb&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;verbose&quot;</span>)
.<span class="ident">short</span>(<span class="string">&#39;v&#39;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>)
.<span class="ident">global</span>(<span class="bool-val">true</span>))
.<span class="ident">subcommand</span>(<span class="ident">Command::new</span>(<span class="string">&quot;test&quot;</span>))
.<span class="ident">subcommand</span>(<span class="ident">Command::new</span>(<span class="string">&quot;do-stuff&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;do-stuff&quot;</span>, <span class="string">&quot;--verbose&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">subcommand_name</span>(), <span class="prelude-val">Some</span>(<span class="string">&quot;do-stuff&quot;</span>));
<span class="kw">let</span> <span class="ident">sub_m</span> <span class="op">=</span> <span class="ident">m</span>.<span class="ident">subcommand_matches</span>(<span class="string">&quot;do-stuff&quot;</span>).<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="kw-2">*</span><span class="ident">sub_m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">bool</span><span class="op">&gt;</span>(<span class="string">&quot;verb&quot;</span>).<span class="ident">expect</span>(<span class="string">&quot;defaulted by clap&quot;</span>), <span class="bool-val">true</span>);</code></pre></div>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Arg-1" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#851-1995">source</a></span><a href="#impl-Arg-1" class="anchor"></a><h3 class="code-header in-band">impl <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h3></section></summary><div class="docblock"><h4 id="value-handling"><a href="#value-handling">Value Handling</a></h4></div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.action" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#882-885">source</a></span><h4 class="code-header">pub fn <a href="#method.action" class="fnname">action</a>(self, action: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="enum" href="builder/enum.ArgAction.html" title="enum clap::builder::ArgAction">ArgAction</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Specify how to react to an argument when parsing it.</p>
<p><a href="builder/enum.ArgAction.html" title="crate::ArgAction">ArgAction</a> controls things like</p>
<ul>
<li>Overwriting previous values with new ones</li>
<li>Appending new values to all previous ones</li>
<li>Counting how many times a flag occurs</li>
</ul>
<p>The default action is <code>ArgAction::Set</code></p>
<h5 id="examples-19"><a href="#examples-19">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">cmd</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;mycmd&quot;</span>)
.<span class="ident">arg</span>(
<span class="ident">Arg::new</span>(<span class="string">&quot;flag&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;flag&quot;</span>)
.<span class="ident">action</span>(<span class="ident">clap::ArgAction::Append</span>)
);
<span class="kw">let</span> <span class="ident">matches</span> <span class="op">=</span> <span class="ident">cmd</span>.<span class="ident">try_get_matches_from</span>([<span class="string">&quot;mycmd&quot;</span>, <span class="string">&quot;--flag&quot;</span>, <span class="string">&quot;value&quot;</span>]).<span class="ident">unwrap</span>();
<span class="macro">assert!</span>(<span class="ident">matches</span>.<span class="ident">contains_id</span>(<span class="string">&quot;flag&quot;</span>));
<span class="macro">assert_eq!</span>(
<span class="ident">matches</span>.<span class="ident">get_many</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;flag&quot;</span>).<span class="ident">unwrap_or_default</span>().<span class="ident">map</span>(<span class="op">|</span><span class="ident">v</span><span class="op">|</span> <span class="ident">v</span>.<span class="ident">as_str</span>()).<span class="ident">collect</span>::<span class="op">&lt;</span><span class="ident">Vec</span><span class="op">&lt;</span><span class="kw">_</span><span class="op">&gt;</span><span class="op">&gt;</span>(),
<span class="macro">vec!</span>[<span class="string">&quot;value&quot;</span>]
);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.value_parser" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#943-946">source</a></span><h4 class="code-header">pub fn <a href="#method.value_parser" class="fnname">value_parser</a>(self, parser: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.ValueParser.html" title="struct clap::builder::ValueParser">ValueParser</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Specify the typed behavior of the argument.</p>
<p>This allows parsing and validating a value before storing it into
<a href="parser/struct.ArgMatches.html" title="crate::ArgMatches"><code>ArgMatches</code></a> as the given type.</p>
<p>Possible value parsers include:</p>
<ul>
<li><a href="macro.value_parser.html" title="crate::value_parser!"><code>value_parser!(T)</code></a> for auto-selecting a value parser for a given type
<ul>
<li>Or <a href="https://doc.rust-lang.org/1.64.0/core/ops/range/trait.RangeBounds.html" title="std::ops::RangeBounds">range expressions like <code>0..=1</code></a> as a shorthand for <a href="builder/struct.RangedI64ValueParser.html" title="crate::builder::RangedI64ValueParser"><code>RangedI64ValueParser</code></a></li>
</ul>
</li>
<li><code>Fn(&amp;str) -&gt; Result&lt;T, E&gt;</code></li>
<li><code>[&amp;str]</code> and <a href="builder/struct.PossibleValuesParser.html" title="crate::builder::PossibleValuesParser"><code>PossibleValuesParser</code></a> for static enumerated values</li>
<li><a href="builder/struct.BoolishValueParser.html" title="crate::builder::BoolishValueParser"><code>BoolishValueParser</code></a>, and <a href="builder/struct.FalseyValueParser.html" title="crate::builder::FalseyValueParser"><code>FalseyValueParser</code></a> for alternative <code>bool</code> implementations</li>
<li><a href="builder/struct.NonEmptyStringValueParser.html" title="crate::builder::NonEmptyStringValueParser"><code>NonEmptyStringValueParser</code></a> for basic validation for strings</li>
<li>or any other <a href="builder/trait.TypedValueParser.html" title="crate::builder::TypedValueParser"><code>TypedValueParser</code></a> implementation</li>
</ul>
<p>The default value is <a href="builder/struct.ValueParser.html#method.string" title="crate::builder::ValueParser::string"><code>ValueParser::string</code></a>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">cmd</span> <span class="op">=</span> <span class="ident">clap::Command::new</span>(<span class="string">&quot;raw&quot;</span>)
.<span class="ident">arg</span>(
<span class="ident">clap::Arg::new</span>(<span class="string">&quot;color&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;color&quot;</span>)
.<span class="ident">value_parser</span>([<span class="string">&quot;always&quot;</span>, <span class="string">&quot;auto&quot;</span>, <span class="string">&quot;never&quot;</span>])
.<span class="ident">default_value</span>(<span class="string">&quot;auto&quot;</span>)
)
.<span class="ident">arg</span>(
<span class="ident">clap::Arg::new</span>(<span class="string">&quot;hostname&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;hostname&quot;</span>)
.<span class="ident">value_parser</span>(<span class="ident">clap::builder::NonEmptyStringValueParser::new</span>())
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">required</span>(<span class="bool-val">true</span>)
)
.<span class="ident">arg</span>(
<span class="ident">clap::Arg::new</span>(<span class="string">&quot;port&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;port&quot;</span>)
.<span class="ident">value_parser</span>(<span class="macro">clap::value_parser!</span>(<span class="ident">u16</span>).<span class="ident">range</span>(<span class="number">3000</span>..))
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">required</span>(<span class="bool-val">true</span>)
);
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">cmd</span>.<span class="ident">try_get_matches_from_mut</span>(
[<span class="string">&quot;cmd&quot;</span>, <span class="string">&quot;--hostname&quot;</span>, <span class="string">&quot;rust-lang.org&quot;</span>, <span class="string">&quot;--port&quot;</span>, <span class="string">&quot;3001&quot;</span>]
).<span class="ident">unwrap</span>();
<span class="kw">let</span> <span class="ident">color</span>: <span class="kw-2">&amp;</span><span class="ident">String</span> <span class="op">=</span> <span class="ident">m</span>.<span class="ident">get_one</span>(<span class="string">&quot;color&quot;</span>)
.<span class="ident">expect</span>(<span class="string">&quot;default&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="ident">color</span>, <span class="string">&quot;auto&quot;</span>);
<span class="kw">let</span> <span class="ident">hostname</span>: <span class="kw-2">&amp;</span><span class="ident">String</span> <span class="op">=</span> <span class="ident">m</span>.<span class="ident">get_one</span>(<span class="string">&quot;hostname&quot;</span>)
.<span class="ident">expect</span>(<span class="string">&quot;required&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="ident">hostname</span>, <span class="string">&quot;rust-lang.org&quot;</span>);
<span class="kw">let</span> <span class="ident">port</span>: <span class="ident">u16</span> <span class="op">=</span> <span class="kw-2">*</span><span class="ident">m</span>.<span class="ident">get_one</span>(<span class="string">&quot;port&quot;</span>)
.<span class="ident">expect</span>(<span class="string">&quot;required&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="ident">port</span>, <span class="number">3001</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.num_args" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#1095-1098">source</a></span><h4 class="code-header">pub fn <a href="#method.num_args" class="fnname">num_args</a>(self, qty: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.ValueRange.html" title="struct clap::builder::ValueRange">ValueRange</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Specifies the number of arguments parsed per occurrence</p>
<p>For example, if you had a <code>-f &lt;file&gt;</code> argument where you wanted exactly 3 files you would
set <code>.num_args(3)</code>, and this argument wouldnt be satisfied unless the user
provided 3 and only 3 values.</p>
<p>Users may specify values for arguments in any of the following methods</p>
<ul>
<li>Using a space such as <code>-o value</code> or <code>--option value</code></li>
<li>Using an equals and no space such as <code>-o=value</code> or <code>--option=value</code></li>
<li>Use a short and no space such as <code>-ovalue</code></li>
</ul>
<p><strong>WARNING:</strong></p>
<p>Setting a variable number of values (e.g. <code>1..=10</code>) for an argument without
other details can be dangerous in some circumstances. Because multiple values are
allowed, <code>--option val1 val2 val3</code> is perfectly valid. Be careful when designing a CLI
where <strong>positional arguments</strong> or <strong>subcommands</strong> are <em>also</em> expected as <code>clap</code> will continue
parsing <em>values</em> until one of the following happens:</p>
<ul>
<li>It reaches the maximum number of values</li>
<li>It reaches a specific number of values</li>
<li>It finds another flag or option (i.e. something that starts with a <code>-</code>)</li>
<li>It reaches the <a href="builder/struct.Arg.html#method.value_terminator" title="Arg::value_terminator"><code>Arg::value_terminator</code></a> if set</li>
</ul>
<p>Alternatively,</p>
<ul>
<li>Use a delimiter between values with <a href="builder/struct.Arg.html#method.value_delimiter" title="Arg::value_delimiter">Arg::value_delimiter</a></li>
<li>Require a flag occurrence per value with <a href="builder/enum.ArgAction.html#variant.Append" title="ArgAction::Append"><code>ArgAction::Append</code></a></li>
<li>Require positional arguments to appear after <code>--</code> with <a href="builder/struct.Arg.html#method.last" title="Arg::last"><code>Arg::last</code></a></li>
</ul>
<h5 id="examples-20"><a href="#examples-20">Examples</a></h5>
<p>Option:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;mode&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;mode&quot;</span>)
.<span class="ident">num_args</span>(<span class="number">1</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--mode&quot;</span>, <span class="string">&quot;fast&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;mode&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;fast&quot;</span>);</code></pre></div>
<p>Flag/option hybrid (see also <a href="builder/struct.Arg.html#method.default_missing_value" title="Arg::default_missing_value">default_missing_value</a>)</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">cmd</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;mode&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;mode&quot;</span>)
.<span class="ident">default_missing_value</span>(<span class="string">&quot;slow&quot;</span>)
.<span class="ident">default_value</span>(<span class="string">&quot;plaid&quot;</span>)
.<span class="ident">num_args</span>(<span class="number">0</span>..<span class="op">=</span><span class="number">1</span>));
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">cmd</span>.<span class="ident">clone</span>()
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--mode&quot;</span>, <span class="string">&quot;fast&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;mode&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;fast&quot;</span>);
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">cmd</span>.<span class="ident">clone</span>()
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--mode&quot;</span>,
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;mode&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;slow&quot;</span>);
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">cmd</span>.<span class="ident">clone</span>()
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>,
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;mode&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;plaid&quot;</span>);</code></pre></div>
<p>Tuples</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">cmd</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;file&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">num_args</span>(<span class="number">2</span>)
.<span class="ident">short</span>(<span class="string">&#39;F&#39;</span>));
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">cmd</span>.<span class="ident">clone</span>()
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;-F&quot;</span>, <span class="string">&quot;in-file&quot;</span>, <span class="string">&quot;out-file&quot;</span>
]);
<span class="macro">assert_eq!</span>(
<span class="ident">m</span>.<span class="ident">get_many</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;file&quot;</span>).<span class="ident">unwrap_or_default</span>().<span class="ident">map</span>(<span class="op">|</span><span class="ident">v</span><span class="op">|</span> <span class="ident">v</span>.<span class="ident">as_str</span>()).<span class="ident">collect</span>::<span class="op">&lt;</span><span class="ident">Vec</span><span class="op">&lt;</span><span class="kw">_</span><span class="op">&gt;</span><span class="op">&gt;</span>(),
<span class="macro">vec!</span>[<span class="string">&quot;in-file&quot;</span>, <span class="string">&quot;out-file&quot;</span>]
);
<span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">cmd</span>.<span class="ident">clone</span>()
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;-F&quot;</span>, <span class="string">&quot;file1&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">res</span>.<span class="ident">unwrap_err</span>().<span class="ident">kind</span>(), <span class="ident">ErrorKind::WrongNumberOfValues</span>);</code></pre></div>
<p>A common mistake is to define an option which allows multiple values and a positional
argument.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">cmd</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;file&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">num_args</span>(<span class="number">0</span>..)
.<span class="ident">short</span>(<span class="string">&#39;F&#39;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;word&quot;</span>));
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">cmd</span>.<span class="ident">clone</span>().<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;-F&quot;</span>, <span class="string">&quot;file1&quot;</span>, <span class="string">&quot;file2&quot;</span>, <span class="string">&quot;file3&quot;</span>, <span class="string">&quot;word&quot;</span>
]);
<span class="kw">let</span> <span class="ident">files</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">m</span>.<span class="ident">get_many</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;file&quot;</span>).<span class="ident">unwrap</span>().<span class="ident">collect</span>();
<span class="macro">assert_eq!</span>(<span class="ident">files</span>, [<span class="string">&quot;file1&quot;</span>, <span class="string">&quot;file2&quot;</span>, <span class="string">&quot;file3&quot;</span>, <span class="string">&quot;word&quot;</span>]); <span class="comment">// wait...what?!</span>
<span class="macro">assert!</span>(<span class="op">!</span><span class="ident">m</span>.<span class="ident">contains_id</span>(<span class="string">&quot;word&quot;</span>)); <span class="comment">// but we clearly used word!</span>
<span class="comment">// but this works</span>
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">cmd</span>.<span class="ident">clone</span>().<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;word&quot;</span>, <span class="string">&quot;-F&quot;</span>, <span class="string">&quot;file1&quot;</span>, <span class="string">&quot;file2&quot;</span>, <span class="string">&quot;file3&quot;</span>,
]);
<span class="kw">let</span> <span class="ident">files</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">m</span>.<span class="ident">get_many</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;file&quot;</span>).<span class="ident">unwrap</span>().<span class="ident">collect</span>();
<span class="macro">assert_eq!</span>(<span class="ident">files</span>, [<span class="string">&quot;file1&quot;</span>, <span class="string">&quot;file2&quot;</span>, <span class="string">&quot;file3&quot;</span>]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;word&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;word&quot;</span>);</code></pre></div>
<p>The problem is <code>clap</code> doesnt know when to stop parsing values for “file”.</p>
<p>A solution for the example above is to limit how many values with a maximum, or specific
number, or to say <a href="builder/enum.ArgAction.html#variant.Append" title="ArgAction::Append"><code>ArgAction::Append</code></a> is ok, but multiple values are not.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;file&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Append</span>)
.<span class="ident">short</span>(<span class="string">&#39;F&#39;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;word&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;-F&quot;</span>, <span class="string">&quot;file1&quot;</span>, <span class="string">&quot;-F&quot;</span>, <span class="string">&quot;file2&quot;</span>, <span class="string">&quot;-F&quot;</span>, <span class="string">&quot;file3&quot;</span>, <span class="string">&quot;word&quot;</span>
]);
<span class="kw">let</span> <span class="ident">files</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">m</span>.<span class="ident">get_many</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;file&quot;</span>).<span class="ident">unwrap</span>().<span class="ident">collect</span>();
<span class="macro">assert_eq!</span>(<span class="ident">files</span>, [<span class="string">&quot;file1&quot;</span>, <span class="string">&quot;file2&quot;</span>, <span class="string">&quot;file3&quot;</span>]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;word&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;word&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.value_name" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#1156-1163">source</a></span><h4 class="code-header">pub fn <a href="#method.value_name" class="fnname">value_name</a>(self, name: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Placeholder for the arguments value in the help message / usage.</p>
<p>This name is cosmetic only; the name is <strong>not</strong> used to access arguments.
This setting can be very helpful when describing the type of input the user should be
using, such as <code>FILE</code>, <code>INTERFACE</code>, etc. Although not required, its somewhat convention to
use all capital letters for the value name.</p>
<p><strong>NOTE:</strong> implicitly sets <a href="builder/struct.Arg.html#method.action"><code>Arg::action(ArgAction::Set)</code></a></p>
<h5 id="examples-21"><a href="#examples-21">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">value_name</span>(<span class="string">&quot;FILE&quot;</span>)</code></pre></div>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">value_name</span>(<span class="string">&quot;FILE&quot;</span>)
.<span class="ident">help</span>(<span class="string">&quot;Some help text&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--help&quot;</span>
]);</code></pre></div>
<p>Running the above program produces the following output</p>
<div class="example-wrap"><pre class="language-text"><code>valnames
Usage: valnames [OPTIONS]
Options:
--config &lt;FILE&gt; Some help text
-h, --help Print help information
-V, --version Print version information</code></pre></div></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.value_names" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#1219-1222">source</a></span><h4 class="code-header">pub fn <a href="#method.value_names" class="fnname">value_names</a>(self, names: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Placeholders for the arguments values in the help message / usage.</p>
<p>These names are cosmetic only, used for help and usage strings only. The names are <strong>not</strong>
used to access arguments. The values of the arguments are accessed in numeric order (i.e.
if you specify two names <code>one</code> and <code>two</code> <code>one</code> will be the first matched value, <code>two</code> will
be the second).</p>
<p>This setting can be very helpful when describing the type of input the user should be
using, such as <code>FILE</code>, <code>INTERFACE</code>, etc. Although not required, its somewhat convention to
use all capital letters for the value name.</p>
<p><strong>Pro Tip:</strong> It may help to use <a href="builder/struct.Arg.html#method.next_line_help"><code>Arg::next_line_help(true)</code></a> if there are long, or
multiple value names in order to not throw off the help text alignment of all options.</p>
<p><strong>NOTE:</strong> implicitly sets <a href="builder/struct.Arg.html#method.action"><code>Arg::action(ArgAction::Set)</code></a> and <a href="builder/struct.Arg.html#method.num_args"><code>Arg::num_args(1..)</code></a>.</p>
<h5 id="examples-22"><a href="#examples-22">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;speed&quot;</span>)
.<span class="ident">short</span>(<span class="string">&#39;s&#39;</span>)
.<span class="ident">value_names</span>([<span class="string">&quot;fast&quot;</span>, <span class="string">&quot;slow&quot;</span>]);</code></pre></div>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;io&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;io-files&quot;</span>)
.<span class="ident">value_names</span>([<span class="string">&quot;INFILE&quot;</span>, <span class="string">&quot;OUTFILE&quot;</span>]))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--help&quot;</span>
]);</code></pre></div>
<p>Running the above program produces the following output</p>
<div class="example-wrap"><pre class="language-text"><code>valnames
Usage: valnames [OPTIONS]
Options:
-h, --help Print help information
--io-files &lt;INFILE&gt; &lt;OUTFILE&gt; Some help text
-V, --version Print version information</code></pre></div></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.value_hint" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#1254-1257">source</a></span><h4 class="code-header">pub fn <a href="#method.value_hint" class="fnname">value_hint</a>(self, value_hint: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="enum" href="builder/enum.ValueHint.html" title="enum clap::builder::ValueHint">ValueHint</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Provide the shell a hint about how to complete this argument.</p>
<p>See <a href="builder/enum.ValueHint.html" title="crate::ValueHint"><code>ValueHint</code></a> for more information.</p>
<p><strong>NOTE:</strong> implicitly sets [<code>Arg::action(ArgAction::Set)</code>].</p>
<p>For example, to take a username as argument:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;user&quot;</span>)
.<span class="ident">short</span>(<span class="string">&#39;u&#39;</span>)
.<span class="ident">long</span>(<span class="string">&quot;user&quot;</span>)
.<span class="ident">value_hint</span>(<span class="ident">ValueHint::Username</span>);</code></pre></div>
<p>To take a full command line and its arguments (for example, when writing a command wrapper):</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">trailing_var_arg</span>(<span class="bool-val">true</span>)
.<span class="ident">arg</span>(
<span class="ident">Arg::new</span>(<span class="string">&quot;command&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">num_args</span>(<span class="number">1</span>..)
.<span class="ident">value_hint</span>(<span class="ident">ValueHint::CommandWithArguments</span>)
);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.ignore_case" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#1309-1315">source</a></span><h4 class="code-header">pub fn <a href="#method.ignore_case" class="fnname">ignore_case</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Match values against <a href="builder/struct.PossibleValuesParser.html" title="crate::builder::PossibleValuesParser"><code>PossibleValuesParser</code></a> without matching case.</p>
<p>When other arguments are conditionally required based on the
value of a case-insensitive argument, the equality check done
by <a href="builder/struct.Arg.html#method.required_if_eq" title="Arg::required_if_eq"><code>Arg::required_if_eq</code></a>, <a href="builder/struct.Arg.html#method.required_if_eq_any" title="Arg::required_if_eq_any"><code>Arg::required_if_eq_any</code></a>, or
<a href="builder/struct.Arg.html#method.required_if_eq_all" title="Arg::required_if_eq_all"><code>Arg::required_if_eq_all</code></a> is case-insensitive.</p>
<p><strong>NOTE:</strong> Setting this requires <a href="builder/struct.Arg.html#method.num_args" title="Arg::num_args">taking values</a></p>
<p><strong>NOTE:</strong> To do unicode case folding, enable the <code>unicode</code> feature flag.</p>
<h5 id="examples-23"><a href="#examples-23">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;pv&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;option&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;option&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">ignore_case</span>(<span class="bool-val">true</span>)
.<span class="ident">value_parser</span>([<span class="string">&quot;test123&quot;</span>]))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;pv&quot;</span>, <span class="string">&quot;--option&quot;</span>, <span class="string">&quot;TeSt123&quot;</span>,
]);
<span class="macro">assert!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;option&quot;</span>).<span class="ident">unwrap</span>().<span class="ident">eq_ignore_ascii_case</span>(<span class="string">&quot;test123&quot;</span>));</code></pre></div>
<p>This setting also works when multiple values can be defined:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;pv&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;option&quot;</span>)
.<span class="ident">short</span>(<span class="string">&#39;o&#39;</span>)
.<span class="ident">long</span>(<span class="string">&quot;option&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">ignore_case</span>(<span class="bool-val">true</span>)
.<span class="ident">num_args</span>(<span class="number">1</span>..)
.<span class="ident">value_parser</span>([<span class="string">&quot;test123&quot;</span>, <span class="string">&quot;test321&quot;</span>]))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;pv&quot;</span>, <span class="string">&quot;--option&quot;</span>, <span class="string">&quot;TeSt123&quot;</span>, <span class="string">&quot;teST123&quot;</span>, <span class="string">&quot;tESt321&quot;</span>
]);
<span class="kw">let</span> <span class="ident">matched_vals</span> <span class="op">=</span> <span class="ident">m</span>.<span class="ident">get_many</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;option&quot;</span>).<span class="ident">unwrap</span>().<span class="ident">collect</span>::<span class="op">&lt;</span><span class="ident">Vec</span><span class="op">&lt;</span><span class="kw">_</span><span class="op">&gt;</span><span class="op">&gt;</span>();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span><span class="kw-2">*</span><span class="ident">matched_vals</span>, <span class="kw-2">&amp;</span>[<span class="string">&quot;TeSt123&quot;</span>, <span class="string">&quot;teST123&quot;</span>, <span class="string">&quot;tESt321&quot;</span>]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.allow_hyphen_values" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#1371-1377">source</a></span><h4 class="code-header">pub fn <a href="#method.allow_hyphen_values" class="fnname">allow_hyphen_values</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Allows values which start with a leading hyphen (<code>-</code>)</p>
<p>To limit values to just numbers, see
<a href="builder/struct.Arg.html#method.allow_negative_numbers" title="Arg::allow_negative_numbers"><code>allow_negative_numbers</code></a>.</p>
<p>See also <a href="builder/struct.Arg.html#method.trailing_var_arg" title="Arg::trailing_var_arg"><code>trailing_var_arg</code></a>.</p>
<p><strong>NOTE:</strong> Setting this requires <a href="builder/struct.Arg.html#method.num_args" title="Arg::num_args">taking values</a></p>
<p><strong>WARNING:</strong> Prior arguments with <code>allow_hyphen_values(true)</code> get precedence over known
flags but known flags get precedence over the next possible positional argument with
<code>allow_hyphen_values(true)</code>. When combined with [<code>Arg::num_args(..)</code>],
<a href="builder/struct.Arg.html#method.value_terminator" title="Arg::value_terminator"><code>Arg::value_terminator</code></a> is one way to ensure processing stops.</p>
<p><strong>WARNING</strong>: Take caution when using this setting combined with another argument using
<a href="builder/struct.Arg.html#method.num_args" title="Arg::num_args"><code>Arg::num_args</code></a>, as this becomes ambiguous <code>$ prog --arg -- -- val</code>. All
three <code>--, --, val</code> will be values when the user may have thought the second <code>--</code> would
constitute the normal, “Only positional args follow” idiom.</p>
<h5 id="examples-24"><a href="#examples-24">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;pat&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">allow_hyphen_values</span>(<span class="bool-val">true</span>)
.<span class="ident">long</span>(<span class="string">&quot;pattern&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--pattern&quot;</span>, <span class="string">&quot;-file&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;pat&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;-file&quot;</span>);</code></pre></div>
<p>Not setting <code>Arg::allow_hyphen_values(true)</code> and supplying a value which starts with a
hyphen is an error.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;pat&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;pattern&quot;</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--pattern&quot;</span>, <span class="string">&quot;-file&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_err</span>());
<span class="macro">assert_eq!</span>(<span class="ident">res</span>.<span class="ident">unwrap_err</span>().<span class="ident">kind</span>(), <span class="ident">ErrorKind::UnknownArgument</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.allow_negative_numbers" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#1400-1406">source</a></span><h4 class="code-header">pub fn <a href="#method.allow_negative_numbers" class="fnname">allow_negative_numbers</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Allows negative numbers to pass as values.</p>
<p>This is similar to <a href="builder/struct.Arg.html#method.allow_hyphen_values" title="Arg::allow_hyphen_values"><code>Arg::allow_hyphen_values</code></a> except that it only allows numbers,
all other undefined leading hyphens will fail to parse.</p>
<p><strong>NOTE:</strong> Setting this requires <a href="builder/struct.Arg.html#method.num_args" title="Arg::num_args">taking values</a></p>
<h5 id="examples-25"><a href="#examples-25">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;myprog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;num&quot;</span>).<span class="ident">allow_negative_numbers</span>(<span class="bool-val">true</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;myprog&quot;</span>, <span class="string">&quot;-20&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_ok</span>());
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">res</span>.<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;num&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;-20&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.require_equals" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#1452-1458">source</a></span><h4 class="code-header">pub fn <a href="#method.require_equals" class="fnname">require_equals</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Requires that options use the <code>--option=val</code> syntax</p>
<p>i.e. an equals between the option and associated value.</p>
<p><strong>NOTE:</strong> Setting this requires <a href="builder/struct.Arg.html#method.num_args" title="Arg::num_args">taking values</a></p>
<h5 id="examples-26"><a href="#examples-26">Examples</a></h5>
<p>Setting <code>require_equals</code> requires that the option have an equals sign between
it and the associated value.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">require_equals</span>(<span class="bool-val">true</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--config=file.conf&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_ok</span>());</code></pre></div>
<p>Setting <code>require_equals</code> and <em>not</em> supplying the equals will cause an
error.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">require_equals</span>(<span class="bool-val">true</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--config&quot;</span>, <span class="string">&quot;file.conf&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_err</span>());
<span class="macro">assert_eq!</span>(<span class="ident">res</span>.<span class="ident">unwrap_err</span>().<span class="ident">kind</span>(), <span class="ident">ErrorKind::NoEquals</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.value_delimiter" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#1501-1504">source</a></span><h4 class="code-header">pub fn <a href="#method.value_delimiter" class="fnname">value_delimiter</a>(self, d: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.char.html">char</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Allow grouping of multiple values via a delimiter.</p>
<p>i.e. should <code>--option=val1,val2,val3</code> be parsed as three values (<code>val1</code>, <code>val2</code>,
and <code>val3</code>) or as a single value (<code>val1,val2,val3</code>). Defaults to using <code>,</code> (comma) as the
value delimiter for all arguments that accept values (options and positional arguments)</p>
<p><strong>NOTE:</strong> implicitly sets <a href="builder/struct.Arg.html#method.action"><code>Arg::action(ArgAction::Set)</code></a></p>
<h5 id="examples-27"><a href="#examples-27">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">short</span>(<span class="string">&#39;c&#39;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">value_delimiter</span>(<span class="string">&#39;,&#39;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--config=val1,val2,val3&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_many</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;config&quot;</span>).<span class="ident">unwrap</span>().<span class="ident">collect</span>::<span class="op">&lt;</span><span class="ident">Vec</span><span class="op">&lt;</span><span class="kw">_</span><span class="op">&gt;</span><span class="op">&gt;</span>(), [<span class="string">&quot;val1&quot;</span>, <span class="string">&quot;val2&quot;</span>, <span class="string">&quot;val3&quot;</span>])</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.value_terminator" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#1554-1557">source</a></span><h4 class="code-header">pub fn <a href="#method.value_terminator" class="fnname">value_terminator</a>(self, term: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Sentinel to <strong>stop</strong> parsing multiple values of a given argument.</p>
<p>By default when
one sets <a href="builder/struct.Arg.html#method.num_args"><code>num_args(1..)</code></a> on an argument, clap will continue parsing values for that
argument until it reaches another valid argument, or one of the other more specific settings
for multiple values is used (such as <a href="builder/struct.Arg.html#method.num_args"><code>num_args</code></a>).</p>
<p><strong>NOTE:</strong> This setting only applies to <a href="builder/struct.Arg.html#method.action">options</a> and <a href="builder/struct.Arg.html#method.index">positional arguments</a></p>
<p><strong>NOTE:</strong> When the terminator is passed in on the command line, it is <strong>not</strong> stored as one
of the values</p>
<h5 id="examples-28"><a href="#examples-28">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;vals&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">num_args</span>(<span class="number">1</span>..)
.<span class="ident">value_terminator</span>(<span class="string">&quot;;&quot;</span>)</code></pre></div>
<p>The following example uses two arguments, a sequence of commands, and the location in which
to perform them</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cmds&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">num_args</span>(<span class="number">1</span>..)
.<span class="ident">allow_hyphen_values</span>(<span class="bool-val">true</span>)
.<span class="ident">value_terminator</span>(<span class="string">&quot;;&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;location&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;find&quot;</span>, <span class="string">&quot;-type&quot;</span>, <span class="string">&quot;f&quot;</span>, <span class="string">&quot;-name&quot;</span>, <span class="string">&quot;special&quot;</span>, <span class="string">&quot;;&quot;</span>, <span class="string">&quot;/home/clap&quot;</span>
]);
<span class="kw">let</span> <span class="ident">cmds</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="kw">_</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">m</span>.<span class="ident">get_many</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;cmds&quot;</span>).<span class="ident">unwrap</span>().<span class="ident">collect</span>();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span><span class="ident">cmds</span>, <span class="kw-2">&amp;</span>[<span class="string">&quot;find&quot;</span>, <span class="string">&quot;-type&quot;</span>, <span class="string">&quot;f&quot;</span>, <span class="string">&quot;-name&quot;</span>, <span class="string">&quot;special&quot;</span>]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;location&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;/home/clap&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.raw" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#1583-1588">source</a></span><h4 class="code-header">pub fn <a href="#method.raw" class="fnname">raw</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Consume all following arguments.</p>
<p>Do not be parse them individually, but rather pass them in entirety.</p>
<p>It is worth noting that setting this requires all values to come after a <code>--</code> to indicate
they should all be captured. For example:</p>
<div class="example-wrap"><pre class="language-text"><code>--foo something -- -v -v -v -b -b -b --baz -q -u -x</code></pre></div>
<p>Will result in everything after <code>--</code> to be considered one raw argument. This behavior
may not be exactly what you are expecting and using <a href="builder/struct.Command.html#method.trailing_var_arg" title="crate::Command::trailing_var_arg"><code>crate::Command::trailing_var_arg</code></a>
may be more appropriate.</p>
<p><strong>NOTE:</strong> Implicitly sets <a href="builder/struct.Arg.html#method.action"><code>Arg::action(ArgAction::Set)</code></a> <a href="builder/struct.Arg.html#method.num_args"><code>Arg::num_args(1..)</code></a>,
<a href="builder/struct.Arg.html#method.allow_hyphen_values"><code>Arg::allow_hyphen_values(true)</code></a>, and <a href="builder/struct.Arg.html#method.last"><code>Arg::last(true)</code></a> when set to <code>true</code>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.default_value" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#1646-1653">source</a></span><h4 class="code-header">pub fn <a href="#method.default_value" class="fnname">default_value</a>(self, val: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Value for the argument when not present.</p>
<p><strong>NOTE:</strong> If the user <em>does not</em> use this argument at runtime <a href="parser/struct.ArgMatches.html#method.contains_id"><code>ArgMatches::contains_id</code></a> will
still return <code>true</code>. If you wish to determine whether the argument was used at runtime or
not, consider <a href="parser/struct.ArgMatches.html#method.value_source" title="crate::ArgMatches::value_source"><code>ArgMatches::value_source</code></a>.</p>
<p><strong>NOTE:</strong> This setting is perfectly compatible with <a href="builder/struct.Arg.html#method.default_value_if"><code>Arg::default_value_if</code></a> but slightly
different. <code>Arg::default_value</code> <em>only</em> takes effect when the user has not provided this arg
at runtime. <code>Arg::default_value_if</code> however only takes effect when the user has not provided
a value at runtime <strong>and</strong> these other conditions are met as well. If you have set
<code>Arg::default_value</code> and <code>Arg::default_value_if</code>, and the user <strong>did not</strong> provide this arg
at runtime, nor were the conditions met for <code>Arg::default_value_if</code>, the <code>Arg::default_value</code>
will be applied.</p>
<p><strong>NOTE:</strong> This implicitly sets <a href="builder/struct.Arg.html#method.action"><code>Arg::action(ArgAction::Set)</code></a>.</p>
<h5 id="examples-29"><a href="#examples-29">Examples</a></h5>
<p>First we use the default value without providing any value at runtime.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;opt&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;myopt&quot;</span>)
.<span class="ident">default_value</span>(<span class="string">&quot;myval&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;opt&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;myval&quot;</span>);
<span class="macro">assert!</span>(<span class="ident">m</span>.<span class="ident">contains_id</span>(<span class="string">&quot;opt&quot;</span>));
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">value_source</span>(<span class="string">&quot;opt&quot;</span>), <span class="prelude-val">Some</span>(<span class="ident">ValueSource::DefaultValue</span>));</code></pre></div>
<p>Next we provide a value at runtime to override the default.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;opt&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;myopt&quot;</span>)
.<span class="ident">default_value</span>(<span class="string">&quot;myval&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--myopt=non_default&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;opt&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;non_default&quot;</span>);
<span class="macro">assert!</span>(<span class="ident">m</span>.<span class="ident">contains_id</span>(<span class="string">&quot;opt&quot;</span>));
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">value_source</span>(<span class="string">&quot;opt&quot;</span>), <span class="prelude-val">Some</span>(<span class="ident">ValueSource::CommandLine</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.default_values" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#1673-1676">source</a></span><h4 class="code-header">pub fn <a href="#method.default_values" class="fnname">default_values</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;vals: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="builder/struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;&gt;<br>) -&gt; Self</h4></section></summary><div class="docblock"><p>Value for the argument when not present.</p>
<p>See <a href="builder/struct.Arg.html#method.default_value"><code>Arg::default_value</code></a>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.default_missing_value" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#1780-1787">source</a></span><h4 class="code-header">pub fn <a href="#method.default_missing_value" class="fnname">default_missing_value</a>(self, val: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Value for the argument when the flag is present but no value is specified.</p>
<p>This configuration option is often used to give the user a shortcut and allow them to
efficiently specify an option argument without requiring an explicitly value. The <code>--color</code>
argument is a common example. By, supplying an default, such as <code>default_missing_value(&quot;always&quot;)</code>,
the user can quickly just add <code>--color</code> to the command line to produce the desired color output.</p>
<p><strong>NOTE:</strong> using this configuration option requires the use of the
<a href="builder/struct.Arg.html#method.num_args" title="Arg::num_args"><code>.num_args(0..N)</code></a> and the
<a href="builder/struct.Arg.html#method.require_equals" title="Arg::require_equals"><code>.require_equals(true)</code></a> configuration option. These are required in
order to unambiguously determine what, if any, value was supplied for the argument.</p>
<h5 id="examples-30"><a href="#examples-30">Examples</a></h5>
<p>For POSIX style <code>--color</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">fn</span> <span class="ident">cli</span>() -&gt; <span class="ident">Command</span> {
<span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;color&quot;</span>).<span class="ident">long</span>(<span class="string">&quot;color&quot;</span>)
.<span class="ident">value_name</span>(<span class="string">&quot;WHEN&quot;</span>)
.<span class="ident">value_parser</span>([<span class="string">&quot;always&quot;</span>, <span class="string">&quot;auto&quot;</span>, <span class="string">&quot;never&quot;</span>])
.<span class="ident">default_value</span>(<span class="string">&quot;auto&quot;</span>)
.<span class="ident">num_args</span>(<span class="number">0</span>..<span class="op">=</span><span class="number">1</span>)
.<span class="ident">require_equals</span>(<span class="bool-val">true</span>)
.<span class="ident">default_missing_value</span>(<span class="string">&quot;always&quot;</span>)
.<span class="ident">help</span>(<span class="string">&quot;Specify WHEN to colorize output.&quot;</span>)
)
}
<span class="comment">// first, we&#39;ll provide no arguments</span>
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">cli</span>().<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;color&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;auto&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">value_source</span>(<span class="string">&quot;color&quot;</span>), <span class="prelude-val">Some</span>(<span class="ident">ValueSource::DefaultValue</span>));
<span class="comment">// next, we&#39;ll provide a runtime value to override the default (as usually done).</span>
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">cli</span>().<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--color=never&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;color&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;never&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">value_source</span>(<span class="string">&quot;color&quot;</span>), <span class="prelude-val">Some</span>(<span class="ident">ValueSource::CommandLine</span>));
<span class="comment">// finally, we will use the shortcut and only provide the argument without a value.</span>
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">cli</span>().<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--color&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;color&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;always&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">value_source</span>(<span class="string">&quot;color&quot;</span>), <span class="prelude-val">Some</span>(<span class="ident">ValueSource::CommandLine</span>));</code></pre></div>
<p>For bool literals:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">fn</span> <span class="ident">cli</span>() -&gt; <span class="ident">Command</span> {
<span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;create&quot;</span>).<span class="ident">long</span>(<span class="string">&quot;create&quot;</span>)
.<span class="ident">value_name</span>(<span class="string">&quot;BOOL&quot;</span>)
.<span class="ident">value_parser</span>(<span class="macro">value_parser!</span>(<span class="ident">bool</span>))
.<span class="ident">num_args</span>(<span class="number">0</span>..<span class="op">=</span><span class="number">1</span>)
.<span class="ident">require_equals</span>(<span class="bool-val">true</span>)
.<span class="ident">default_missing_value</span>(<span class="string">&quot;true&quot;</span>)
)
}
<span class="comment">// first, we&#39;ll provide no arguments</span>
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">cli</span>().<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">bool</span><span class="op">&gt;</span>(<span class="string">&quot;create&quot;</span>).<span class="ident">copied</span>(), <span class="prelude-val">None</span>);
<span class="comment">// next, we&#39;ll provide a runtime value to override the default (as usually done).</span>
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">cli</span>().<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--create=false&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">bool</span><span class="op">&gt;</span>(<span class="string">&quot;create&quot;</span>).<span class="ident">copied</span>(), <span class="prelude-val">Some</span>(<span class="bool-val">false</span>));
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">value_source</span>(<span class="string">&quot;create&quot;</span>), <span class="prelude-val">Some</span>(<span class="ident">ValueSource::CommandLine</span>));
<span class="comment">// finally, we will use the shortcut and only provide the argument without a value.</span>
<span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">cli</span>().<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--create&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">bool</span><span class="op">&gt;</span>(<span class="string">&quot;create&quot;</span>).<span class="ident">copied</span>(), <span class="prelude-val">Some</span>(<span class="bool-val">true</span>));
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">value_source</span>(<span class="string">&quot;create&quot;</span>), <span class="prelude-val">Some</span>(<span class="ident">ValueSource::CommandLine</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.default_missing_value_os" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#1797-1799">source</a></span><h4 class="code-header">pub fn <a href="#method.default_missing_value_os" class="fnname">default_missing_value_os</a>(self, val: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="builder/struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Value for the argument when the flag is present but no value is specified.</p>
<p>See <a href="builder/struct.Arg.html#method.default_missing_value"><code>Arg::default_missing_value</code></a>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.default_missing_values" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#1808-1810">source</a></span><h4 class="code-header">pub fn <a href="#method.default_missing_values" class="fnname">default_missing_values</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;vals: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="builder/struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;&gt;<br>) -&gt; Self</h4></section></summary><div class="docblock"><p>Value for the argument when the flag is present but no value is specified.</p>
<p>See <a href="builder/struct.Arg.html#method.default_missing_value"><code>Arg::default_missing_value</code></a>.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.default_missing_values_os" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#1820-1826">source</a></span><h4 class="code-header">pub fn <a href="#method.default_missing_values_os" class="fnname">default_missing_values_os</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;vals: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="builder/struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;&gt;<br>) -&gt; Self</h4></section></summary><div class="docblock"><p>Value for the argument when the flag is present but no value is specified.</p>
<p>See <a href="builder/struct.Arg.html#method.default_missing_values"><code>Arg::default_missing_values</code></a>.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Arg-2" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#1998-2549">source</a></span><a href="#impl-Arg-2" class="anchor"></a><h3 class="code-header in-band">impl <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h3></section></summary><div class="docblock"><h4 id="help"><a href="#help">Help</a></h4></div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.help" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#2043-2046">source</a></span><h4 class="code-header">pub fn <a href="#method.help" class="fnname">help</a>(self, h: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Sets the description of the argument for short help (<code>-h</code>).</p>
<p>Typically, this is a short (one line) description of the arg.</p>
<p>If <a href="builder/struct.Arg.html#method.long_help"><code>Arg::long_help</code></a> is not specified, this message will be displayed for <code>--help</code>.</p>
<p><strong>NOTE:</strong> Only <code>Arg::help</code> is used in completion script generation in order to be concise</p>
<h5 id="examples-31"><a href="#examples-31">Examples</a></h5>
<p>Any valid UTF-8 is allowed in the help text. The one exception is when one wishes to
include a newline in the help text and have the following text be properly aligned with all
the other help text.</p>
<p>Setting <code>help</code> displays a short message to the side of the argument when the user passes
<code>-h</code> or <code>--help</code> (by default).</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">help</span>(<span class="string">&quot;Some help text describing the --config arg&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--help&quot;</span>
]);</code></pre></div>
<p>The above example displays</p>
<div class="example-wrap"><pre class="language-notrust"><code>helptest
Usage: helptest [OPTIONS]
Options:
--config Some help text describing the --config arg
-h, --help Print help information
-V, --version Print version information</code></pre></div></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.long_help" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#2105-2108">source</a></span><h4 class="code-header">pub fn <a href="#method.long_help" class="fnname">long_help</a>(self, h: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Sets the description of the argument for long help (<code>--help</code>).</p>
<p>Typically this a more detailed (multi-line) message
that describes the arg.</p>
<p>If <a href="builder/struct.Arg.html#method.help"><code>Arg::help</code></a> is not specified, this message will be displayed for <code>-h</code>.</p>
<p><strong>NOTE:</strong> Only <a href="builder/struct.Arg.html#method.help"><code>Arg::help</code></a> is used in completion script generation in order to be concise</p>
<h5 id="examples-32"><a href="#examples-32">Examples</a></h5>
<p>Any valid UTF-8 is allowed in the help text. The one exception is when one wishes to
include a newline in the help text and have the following text be properly aligned with all
the other help text.</p>
<p>Setting <code>help</code> displays a short message to the side of the argument when the user passes
<code>-h</code> or <code>--help</code> (by default).</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">long_help</span>(
<span class="string">&quot;The config file used by the myprog must be in JSON format
with only valid keys and may not contain other nonsense
that cannot be read by this program. Obviously I&#39;m going on
and on, so I&#39;ll stop now.&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--help&quot;</span>
]);</code></pre></div>
<p>The above example displays</p>
<div class="example-wrap"><pre class="language-text"><code>prog
Usage: prog [OPTIONS]
Options:
--config
The config file used by the myprog must be in JSON format
with only valid keys and may not contain other nonsense
that cannot be read by this program. Obviously I&#39;m going on
and on, so I&#39;ll stop now.
-h, --help
Print help information
-V, --version
Print version information</code></pre></div></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.display_order" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#2165-2168">source</a></span><h4 class="code-header">pub fn <a href="#method.display_order" class="fnname">display_order</a>(self, ord: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.usize.html">usize</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Allows custom ordering of args within the help message.</p>
<p>Args with a lower value will be displayed first in the help message. This is helpful when
one would like to emphasise frequently used args, or prioritize those towards the top of
the list. Args with duplicate display orders will be displayed in alphabetical order.</p>
<p><strong>NOTE:</strong> The default is 999 for all arguments.</p>
<p><strong>NOTE:</strong> This setting is ignored for <a href="builder/struct.Arg.html#method.index">positional arguments</a> which are always displayed in
<a href="builder/struct.Arg.html#method.index">index</a> order.</p>
<h5 id="examples-33"><a href="#examples-33">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;a&quot;</span>) <span class="comment">// Typically args are grouped alphabetically by name.</span>
<span class="comment">// Args without a display_order have a value of 999 and are</span>
<span class="comment">// displayed alphabetically with all other 999 valued args.</span>
.<span class="ident">long</span>(<span class="string">&quot;long-option&quot;</span>)
.<span class="ident">short</span>(<span class="string">&#39;o&#39;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">help</span>(<span class="string">&quot;Some help and text&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;b&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;other-option&quot;</span>)
.<span class="ident">short</span>(<span class="string">&#39;O&#39;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">display_order</span>(<span class="number">1</span>) <span class="comment">// In order to force this arg to appear *first*</span>
<span class="comment">// all we have to do is give it a value lower than 999.</span>
<span class="comment">// Any other args with a value of 1 will be displayed</span>
<span class="comment">// alphabetically with this one...then 2 values, then 3, etc.</span>
.<span class="ident">help</span>(<span class="string">&quot;I should be first!&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--help&quot;</span>
]);</code></pre></div>
<p>The above example displays the following help message</p>
<div class="example-wrap"><pre class="language-text"><code>cust-ord
Usage: cust-ord [OPTIONS]
Options:
-h, --help Print help information
-V, --version Print version information
-O, --other-option &lt;b&gt; I should be first!
-o, --long-option &lt;a&gt; Some help and text</code></pre></div></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.help_heading" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#2175-2178">source</a></span><h4 class="code-header">pub fn <a href="#method.help_heading" class="fnname">help_heading</a>(self, heading: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Override the <a href="builder/struct.Command.html#method.next_help_heading">current</a> help section.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.next_line_help" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#2225-2231">source</a></span><h4 class="code-header">pub fn <a href="#method.next_line_help" class="fnname">next_line_help</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Render the <a href="builder/struct.Arg.html#method.help" title="Arg::help">help</a> on the line after the argument.</p>
<p>This can be helpful for arguments with very long or complex help messages.
This can also be helpful for arguments with very long flag names, or many/long value names.</p>
<p><strong>NOTE:</strong> To apply this setting to all arguments and subcommands, consider using
<a href="builder/struct.Command.html#method.next_line_help" title="crate::Command::next_line_help"><code>crate::Command::next_line_help</code></a></p>
<h5 id="examples-34"><a href="#examples-34">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;opt&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;long-option-flag&quot;</span>)
.<span class="ident">short</span>(<span class="string">&#39;o&#39;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">next_line_help</span>(<span class="bool-val">true</span>)
.<span class="ident">value_names</span>([<span class="string">&quot;value1&quot;</span>, <span class="string">&quot;value2&quot;</span>])
.<span class="ident">help</span>(<span class="string">&quot;Some really long help and complex\n\
help that makes more sense to be\n\
on a line after the option&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--help&quot;</span>
]);</code></pre></div>
<p>The above example displays the following help message</p>
<div class="example-wrap"><pre class="language-text"><code>nlh
Usage: nlh [OPTIONS]
Options:
-h, --help Print help information
-V, --version Print version information
-o, --long-option-flag &lt;value1&gt; &lt;value2&gt;
Some really long help and complex
help that makes more sense to be
on a line after the option</code></pre></div></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.hide" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#2267-2273">source</a></span><h4 class="code-header">pub fn <a href="#method.hide" class="fnname">hide</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Do not display the argument in help message.</p>
<p><strong>NOTE:</strong> This does <strong>not</strong> hide the argument from usage strings on error</p>
<h5 id="examples-35"><a href="#examples-35">Examples</a></h5>
<p>Setting <code>Hidden</code> will hide the argument when displaying help text</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">hide</span>(<span class="bool-val">true</span>)
.<span class="ident">help</span>(<span class="string">&quot;Some help text describing the --config arg&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--help&quot;</span>
]);</code></pre></div>
<p>The above example displays</p>
<div class="example-wrap"><pre class="language-text"><code>helptest
Usage: helptest [OPTIONS]
Options:
-h, --help Print help information
-V, --version Print version information</code></pre></div></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.hide_possible_values" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#2300-2306">source</a></span><h4 class="code-header">pub fn <a href="#method.hide_possible_values" class="fnname">hide_possible_values</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Do not display the <a href="builder/struct.ValueParser.html#method.possible_values" title="crate::builder::ValueParser::possible_values">possible values</a> in the help message.</p>
<p>This is useful for args with many values, or ones which are explained elsewhere in the
help text.</p>
<p><strong>NOTE:</strong> Setting this requires <a href="builder/struct.Arg.html#method.num_args" title="Arg::num_args">taking values</a></p>
<p>To set this for all arguments, see
<a href="builder/struct.Command.html#method.hide_possible_values" title="crate::Command::hide_possible_values"><code>Command::hide_possible_values</code></a>.</p>
<h5 id="examples-36"><a href="#examples-36">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;mode&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;mode&quot;</span>)
.<span class="ident">value_parser</span>([<span class="string">&quot;fast&quot;</span>, <span class="string">&quot;slow&quot;</span>])
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">hide_possible_values</span>(<span class="bool-val">true</span>));</code></pre></div>
<p>If we were to run the above program with <code>--help</code> the <code>[values: fast, slow]</code> portion of
the help text would be omitted.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.hide_default_value" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#2331-2337">source</a></span><h4 class="code-header">pub fn <a href="#method.hide_default_value" class="fnname">hide_default_value</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Do not display the default value of the argument in the help message.</p>
<p>This is useful when default behavior of an arg is explained elsewhere in the help text.</p>
<p><strong>NOTE:</strong> Setting this requires <a href="builder/struct.Arg.html#method.num_args" title="Arg::num_args">taking values</a></p>
<h5 id="examples-37"><a href="#examples-37">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;connect&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;host&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;host&quot;</span>)
.<span class="ident">default_value</span>(<span class="string">&quot;localhost&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">hide_default_value</span>(<span class="bool-val">true</span>));
</code></pre></div>
<p>If we were to run the above program with <code>--help</code> the <code>[default: localhost]</code> portion of
the help text would be omitted.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.hide_short_help" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#2469-2475">source</a></span><h4 class="code-header">pub fn <a href="#method.hide_short_help" class="fnname">hide_short_help</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Hides an argument from short help (<code>-h</code>).</p>
<p><strong>NOTE:</strong> This does <strong>not</strong> hide the argument from usage strings on error</p>
<p><strong>NOTE:</strong> Setting this option will cause next-line-help output style to be used
when long help (<code>--help</code>) is called.</p>
<h5 id="examples-38"><a href="#examples-38">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">hide_short_help</span>(<span class="bool-val">true</span>);</code></pre></div>
<p>Setting <code>hide_short_help(true)</code> will hide the argument when displaying short help text</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">hide_short_help</span>(<span class="bool-val">true</span>)
.<span class="ident">help</span>(<span class="string">&quot;Some help text describing the --config arg&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;-h&quot;</span>
]);</code></pre></div>
<p>The above example displays</p>
<div class="example-wrap"><pre class="language-text"><code>helptest
Usage: helptest [OPTIONS]
Options:
-h, --help Print help information
-V, --version Print version information</code></pre></div>
<p>However, when help is called</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">hide_short_help</span>(<span class="bool-val">true</span>)
.<span class="ident">help</span>(<span class="string">&quot;Some help text describing the --config arg&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--help&quot;</span>
]);</code></pre></div>
<p>Then the following would be displayed</p>
<div class="example-wrap"><pre class="language-text"><code>helptest
Usage: helptest [OPTIONS]
Options:
--config Some help text describing the --config arg
-h, --help Print help information
-V, --version Print version information</code></pre></div></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.hide_long_help" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#2542-2548">source</a></span><h4 class="code-header">pub fn <a href="#method.hide_long_help" class="fnname">hide_long_help</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Hides an argument from long help (<code>--help</code>).</p>
<p><strong>NOTE:</strong> This does <strong>not</strong> hide the argument from usage strings on error</p>
<p><strong>NOTE:</strong> Setting this option will cause next-line-help output style to be used
when long help (<code>--help</code>) is called.</p>
<h5 id="examples-39"><a href="#examples-39">Examples</a></h5>
<p>Setting <code>hide_long_help(true)</code> will hide the argument when displaying long help text</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">hide_long_help</span>(<span class="bool-val">true</span>)
.<span class="ident">help</span>(<span class="string">&quot;Some help text describing the --config arg&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--help&quot;</span>
]);</code></pre></div>
<p>The above example displays</p>
<div class="example-wrap"><pre class="language-text"><code>helptest
Usage: helptest [OPTIONS]
Options:
-h, --help Print help information
-V, --version Print version information</code></pre></div>
<p>However, when -h is called</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">hide_long_help</span>(<span class="bool-val">true</span>)
.<span class="ident">help</span>(<span class="string">&quot;Some help text describing the --config arg&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;-h&quot;</span>
]);</code></pre></div>
<p>Then the following would be displayed</p>
<div class="example-wrap"><pre class="language-text"><code>helptest
Usage: helptest [OPTIONS]
OPTIONS:
--config Some help text describing the --config arg
-h, --help Print help information
-V, --version Print version information</code></pre></div></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Arg-3" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#2552-3692">source</a></span><a href="#impl-Arg-3" class="anchor"></a><h3 class="code-header in-band">impl <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h3></section></summary><div class="docblock"><h4 id="advanced-argument-relations"><a href="#advanced-argument-relations">Advanced Argument Relations</a></h4></div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.group" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#2588-2595">source</a></span><h4 class="code-header">pub fn <a href="#method.group" class="fnname">group</a>(self, group_id: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.Id.html" title="struct clap::Id">Id</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>The name of the <a href="builder/struct.ArgGroup.html"><code>ArgGroup</code></a> the argument belongs to.</p>
<h5 id="examples-40"><a href="#examples-40">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>)
.<span class="ident">group</span>(<span class="string">&quot;mode&quot;</span>)</code></pre></div>
<p>Multiple arguments can be a member of a single group and then the group checked as if it
was one of said arguments.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>)
.<span class="ident">group</span>(<span class="string">&quot;mode&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;verbose&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;verbose&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>)
.<span class="ident">group</span>(<span class="string">&quot;mode&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--debug&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">m</span>.<span class="ident">contains_id</span>(<span class="string">&quot;mode&quot;</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.groups" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#2633-2636">source</a></span><h4 class="code-header">pub fn <a href="#method.groups" class="fnname">groups</a>(self, group_ids: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Id.html" title="struct clap::Id">Id</a>&gt;&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>The names of <a href="builder/struct.ArgGroup.html"><code>ArgGroup</code></a>s the argument belongs to.</p>
<h5 id="examples-41"><a href="#examples-41">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>)
.<span class="ident">groups</span>([<span class="string">&quot;mode&quot;</span>, <span class="string">&quot;verbosity&quot;</span>])</code></pre></div>
<p>Arguments can be members of multiple groups and then the group checked as if it
was one of said arguments.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>)
.<span class="ident">groups</span>([<span class="string">&quot;mode&quot;</span>, <span class="string">&quot;verbosity&quot;</span>]))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;verbose&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;verbose&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>)
.<span class="ident">groups</span>([<span class="string">&quot;mode&quot;</span>, <span class="string">&quot;verbosity&quot;</span>]))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--debug&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">m</span>.<span class="ident">contains_id</span>(<span class="string">&quot;mode&quot;</span>));
<span class="macro">assert!</span>(<span class="ident">m</span>.<span class="ident">contains_id</span>(<span class="string">&quot;verbosity&quot;</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.default_value_if" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#2749-2761">source</a></span><h4 class="code-header">pub fn <a href="#method.default_value_if" class="fnname">default_value_if</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;arg_id: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Id.html" title="struct clap::Id">Id</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;predicate: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="builder/enum.ArgPredicate.html" title="enum clap::builder::ArgPredicate">ArgPredicate</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;default: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;<br>) -&gt; Self</h4></section></summary><div class="docblock"><p>Specifies the value of the argument if <code>arg</code> has been used at runtime.</p>
<p>If <code>default</code> is set to <code>None</code>, <code>default_value</code> will be removed.</p>
<p><strong>NOTE:</strong> This setting is perfectly compatible with <a href="builder/struct.Arg.html#method.default_value"><code>Arg::default_value</code></a> but slightly
different. <code>Arg::default_value</code> <em>only</em> takes effect when the user has not provided this arg
at runtime. This setting however only takes effect when the user has not provided a value at
runtime <strong>and</strong> these other conditions are met as well. If you have set <code>Arg::default_value</code>
and <code>Arg::default_value_if</code>, and the user <strong>did not</strong> provide this arg at runtime, nor were
the conditions met for <code>Arg::default_value_if</code>, the <code>Arg::default_value</code> will be applied.</p>
<p><strong>NOTE:</strong> This implicitly sets <a href="builder/struct.Arg.html#method.action"><code>Arg::action(ArgAction::Set)</code></a>.</p>
<h5 id="examples-42"><a href="#examples-42">Examples</a></h5>
<p>First we use the default value only if another arg is present at runtime.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;flag&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;flag&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">default_value_if</span>(<span class="string">&quot;flag&quot;</span>, <span class="ident">ArgPredicate::IsPresent</span>, <span class="prelude-val">Some</span>(<span class="string">&quot;default&quot;</span>)))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--flag&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;other&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;default&quot;</span>);</code></pre></div>
<p>Next we run the same test, but without providing <code>--flag</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;flag&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;flag&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">default_value_if</span>(<span class="string">&quot;flag&quot;</span>, <span class="string">&quot;true&quot;</span>, <span class="prelude-val">Some</span>(<span class="string">&quot;default&quot;</span>)))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;other&quot;</span>), <span class="prelude-val">None</span>);</code></pre></div>
<p>Now lets only use the default value if <code>--opt</code> contains the value <code>special</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;opt&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;opt&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">default_value_if</span>(<span class="string">&quot;opt&quot;</span>, <span class="string">&quot;special&quot;</span>, <span class="prelude-val">Some</span>(<span class="string">&quot;default&quot;</span>)))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--opt&quot;</span>, <span class="string">&quot;special&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;other&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;default&quot;</span>);</code></pre></div>
<p>We can run the same test and provide any value <em>other than</em> <code>special</code> and we wont get a
default value.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;opt&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;opt&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">default_value_if</span>(<span class="string">&quot;opt&quot;</span>, <span class="string">&quot;special&quot;</span>, <span class="prelude-val">Some</span>(<span class="string">&quot;default&quot;</span>)))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--opt&quot;</span>, <span class="string">&quot;hahaha&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;other&quot;</span>), <span class="prelude-val">None</span>);</code></pre></div>
<p>If we want to unset the default value for an Arg based on the presence or
value of some other Arg.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;flag&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;flag&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">default_value</span>(<span class="string">&quot;default&quot;</span>)
.<span class="ident">default_value_if</span>(<span class="string">&quot;flag&quot;</span>, <span class="string">&quot;true&quot;</span>, <span class="prelude-val">None</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--flag&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;other&quot;</span>), <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.default_value_ifs" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#2860-2874">source</a></span><h4 class="code-header">pub fn <a href="#method.default_value_ifs" class="fnname">default_value_ifs</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;ifs: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = (impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Id.html" title="struct clap::Id">Id</a>&gt;, impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="builder/enum.ArgPredicate.html" title="enum clap::builder::ArgPredicate">ArgPredicate</a>&gt;, impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;)&gt;<br>) -&gt; Self</h4></section></summary><div class="docblock"><p>Specifies multiple values and conditions in the same manner as <a href="builder/struct.Arg.html#method.default_value_if"><code>Arg::default_value_if</code></a>.</p>
<p>The method takes a slice of tuples in the <code>(arg, predicate, default)</code> format.</p>
<p><strong>NOTE</strong>: The conditions are stored in order and evaluated in the same order. I.e. the first
if multiple conditions are true, the first one found will be applied and the ultimate value.</p>
<h5 id="examples-43"><a href="#examples-43">Examples</a></h5>
<p>First we use the default value only if another arg is present at runtime.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;flag&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;flag&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;opt&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;opt&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">default_value_ifs</span>([
(<span class="string">&quot;flag&quot;</span>, <span class="string">&quot;true&quot;</span>, <span class="prelude-val">Some</span>(<span class="string">&quot;default&quot;</span>)),
(<span class="string">&quot;opt&quot;</span>, <span class="string">&quot;channal&quot;</span>, <span class="prelude-val">Some</span>(<span class="string">&quot;chan&quot;</span>)),
]))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--opt&quot;</span>, <span class="string">&quot;channal&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;other&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;chan&quot;</span>);</code></pre></div>
<p>Next we run the same test, but without providing <code>--flag</code>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;flag&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;flag&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">default_value_ifs</span>([
(<span class="string">&quot;flag&quot;</span>, <span class="string">&quot;true&quot;</span>, <span class="prelude-val">Some</span>(<span class="string">&quot;default&quot;</span>)),
(<span class="string">&quot;opt&quot;</span>, <span class="string">&quot;channal&quot;</span>, <span class="prelude-val">Some</span>(<span class="string">&quot;chan&quot;</span>)),
]))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;other&quot;</span>), <span class="prelude-val">None</span>);</code></pre></div>
<p>We can also see that these values are applied in order, and if more than one condition is
true, only the first evaluated “wins”</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;flag&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;flag&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;opt&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;opt&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">default_value_ifs</span>([
(<span class="string">&quot;flag&quot;</span>, <span class="ident">ArgPredicate::IsPresent</span>, <span class="prelude-val">Some</span>(<span class="string">&quot;default&quot;</span>)),
(<span class="string">&quot;opt&quot;</span>, <span class="ident">ArgPredicate::Equals</span>(<span class="string">&quot;channal&quot;</span>.<span class="ident">into</span>()), <span class="prelude-val">Some</span>(<span class="string">&quot;chan&quot;</span>)),
]))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--opt&quot;</span>, <span class="string">&quot;channal&quot;</span>, <span class="string">&quot;--flag&quot;</span>
]);
<span class="macro">assert_eq!</span>(<span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>(<span class="string">&quot;other&quot;</span>).<span class="ident">unwrap</span>(), <span class="string">&quot;default&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.required_unless_present" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#2949-2956">source</a></span><h4 class="code-header">pub fn <a href="#method.required_unless_present" class="fnname">required_unless_present</a>(self, arg_id: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.Id.html" title="struct clap::Id">Id</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Set this arg as <a href="builder/struct.Arg.html#method.required">required</a> as long as the specified argument is not present at runtime.</p>
<p><strong>Pro Tip:</strong> Using <code>Arg::required_unless_present</code> implies <a href="builder/struct.Arg.html#method.required" title="Arg::required"><code>Arg::required</code></a> and is therefore not
mandatory to also set.</p>
<h5 id="examples-44"><a href="#examples-44">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">required_unless_present</span>(<span class="string">&quot;debug&quot;</span>)</code></pre></div>
<p>In the following example, the required argument is <em>not</em> provided,
but its not an error because the <code>unless</code> arg has been supplied.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">required_unless_present</span>(<span class="string">&quot;dbg&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;dbg&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--debug&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_ok</span>());</code></pre></div>
<p>Setting <code>Arg::required_unless_present(name)</code> and <em>not</em> supplying <code>name</code> or this arg is an error.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">required_unless_present</span>(<span class="string">&quot;dbg&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;dbg&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;debug&quot;</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_err</span>());
<span class="macro">assert_eq!</span>(<span class="ident">res</span>.<span class="ident">unwrap_err</span>().<span class="ident">kind</span>(), <span class="ident">ErrorKind::MissingRequiredArgument</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.required_unless_present_all" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3026-3032">source</a></span><h4 class="code-header">pub fn <a href="#method.required_unless_present_all" class="fnname">required_unless_present_all</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;names: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Id.html" title="struct clap::Id">Id</a>&gt;&gt;<br>) -&gt; Self</h4></section></summary><div class="docblock"><p>Sets this arg as <a href="builder/struct.Arg.html#method.required">required</a> unless <em>all</em> of the specified arguments are present at runtime.</p>
<p>In other words, parsing will succeed only if user either</p>
<ul>
<li>supplies the <code>self</code> arg.</li>
<li>supplies <em>all</em> of the <code>names</code> arguments.</li>
</ul>
<p><strong>NOTE:</strong> If you wish for this argument to only be required unless <em>any of</em> these args are
present see <a href="builder/struct.Arg.html#method.required_unless_present_any"><code>Arg::required_unless_present_any</code></a></p>
<h5 id="examples-45"><a href="#examples-45">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">required_unless_present_all</span>([<span class="string">&quot;cfg&quot;</span>, <span class="string">&quot;dbg&quot;</span>])</code></pre></div>
<p>In the following example, the required argument is <em>not</em> provided, but its not an error
because <em>all</em> of the <code>names</code> args have been supplied.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">required_unless_present_all</span>([<span class="string">&quot;dbg&quot;</span>, <span class="string">&quot;infile&quot;</span>])
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;dbg&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;infile&quot;</span>)
.<span class="ident">short</span>(<span class="string">&#39;i&#39;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--debug&quot;</span>, <span class="string">&quot;-i&quot;</span>, <span class="string">&quot;file&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_ok</span>());</code></pre></div>
<p>Setting <a href="builder/struct.Arg.html#method.required_unless_present_all"><code>Arg::required_unless_present_all(names)</code></a> and <em>not</em> supplying
either <em>all</em> of <code>unless</code> args or the <code>self</code> arg is an error.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">required_unless_present_all</span>([<span class="string">&quot;dbg&quot;</span>, <span class="string">&quot;infile&quot;</span>])
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;dbg&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;infile&quot;</span>)
.<span class="ident">short</span>(<span class="string">&#39;i&#39;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_err</span>());
<span class="macro">assert_eq!</span>(<span class="ident">res</span>.<span class="ident">unwrap_err</span>().<span class="ident">kind</span>(), <span class="ident">ErrorKind::MissingRequiredArgument</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.required_unless_present_any" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3104-3110">source</a></span><h4 class="code-header">pub fn <a href="#method.required_unless_present_any" class="fnname">required_unless_present_any</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;names: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Id.html" title="struct clap::Id">Id</a>&gt;&gt;<br>) -&gt; Self</h4></section></summary><div class="docblock"><p>Sets this arg as <a href="builder/struct.Arg.html#method.required">required</a> unless <em>any</em> of the specified arguments are present at runtime.</p>
<p>In other words, parsing will succeed only if user either</p>
<ul>
<li>supplies the <code>self</code> arg.</li>
<li>supplies <em>one or more</em> of the <code>unless</code> arguments.</li>
</ul>
<p><strong>NOTE:</strong> If you wish for this argument to be required unless <em>all of</em> these args are
present see <a href="builder/struct.Arg.html#method.required_unless_present_all"><code>Arg::required_unless_present_all</code></a></p>
<h5 id="examples-46"><a href="#examples-46">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">required_unless_present_any</span>([<span class="string">&quot;cfg&quot;</span>, <span class="string">&quot;dbg&quot;</span>])</code></pre></div>
<p>Setting <a href="builder/struct.Arg.html#method.required_unless_present_any"><code>Arg::required_unless_present_any(names)</code></a> requires that the argument be used at runtime
<em>unless</em> <em>at least one of</em> the args in <code>names</code> are present. In the following example, the
required argument is <em>not</em> provided, but its not an error because one the <code>unless</code> args
have been supplied.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">required_unless_present_any</span>([<span class="string">&quot;dbg&quot;</span>, <span class="string">&quot;infile&quot;</span>])
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;dbg&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;infile&quot;</span>)
.<span class="ident">short</span>(<span class="string">&#39;i&#39;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--debug&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_ok</span>());</code></pre></div>
<p>Setting <a href="builder/struct.Arg.html#method.required_unless_present_any"><code>Arg::required_unless_present_any(names)</code></a> and <em>not</em> supplying <em>at least one of</em> <code>names</code>
or this arg is an error.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">required_unless_present_any</span>([<span class="string">&quot;dbg&quot;</span>, <span class="string">&quot;infile&quot;</span>])
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;dbg&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;infile&quot;</span>)
.<span class="ident">short</span>(<span class="string">&#39;i&#39;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_err</span>());
<span class="macro">assert_eq!</span>(<span class="ident">res</span>.<span class="ident">unwrap_err</span>().<span class="ident">kind</span>(), <span class="ident">ErrorKind::MissingRequiredArgument</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.required_if_eq" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3192-3195">source</a></span><h4 class="code-header">pub fn <a href="#method.required_if_eq" class="fnname">required_if_eq</a>(self, arg_id: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Id.html" title="struct clap::Id">Id</a>&gt;, val: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="builder/struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>This argument is <a href="builder/struct.Arg.html#method.required">required</a> only if the specified <code>arg</code> is present at runtime and its value
equals <code>val</code>.</p>
<h5 id="examples-47"><a href="#examples-47">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">required_if_eq</span>(<span class="string">&quot;other_arg&quot;</span>, <span class="string">&quot;value&quot;</span>)</code></pre></div>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">required_if_eq</span>(<span class="string">&quot;other&quot;</span>, <span class="string">&quot;special&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--other&quot;</span>, <span class="string">&quot;not-special&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_ok</span>()); <span class="comment">// We didn&#39;t use --other=special, so &quot;cfg&quot; wasn&#39;t required</span>
<span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">required_if_eq</span>(<span class="string">&quot;other&quot;</span>, <span class="string">&quot;special&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--other&quot;</span>, <span class="string">&quot;special&quot;</span>
]);
<span class="comment">// We did use --other=special so &quot;cfg&quot; had become required but was missing.</span>
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_err</span>());
<span class="macro">assert_eq!</span>(<span class="ident">res</span>.<span class="ident">unwrap_err</span>().<span class="ident">kind</span>(), <span class="ident">ErrorKind::MissingRequiredArgument</span>);
<span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">required_if_eq</span>(<span class="string">&quot;other&quot;</span>, <span class="string">&quot;special&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--other&quot;</span>, <span class="string">&quot;SPECIAL&quot;</span>
]);
<span class="comment">// By default, the comparison is case-sensitive, so &quot;cfg&quot; wasn&#39;t required</span>
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_ok</span>());
<span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">required_if_eq</span>(<span class="string">&quot;other&quot;</span>, <span class="string">&quot;special&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;other&quot;</span>)
.<span class="ident">ignore_case</span>(<span class="bool-val">true</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--other&quot;</span>, <span class="string">&quot;SPECIAL&quot;</span>
]);
<span class="comment">// However, case-insensitive comparisons can be enabled. This typically occurs when using Arg::possible_values().</span>
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_err</span>());
<span class="macro">assert_eq!</span>(<span class="ident">res</span>.<span class="ident">unwrap_err</span>().<span class="ident">kind</span>(), <span class="ident">ErrorKind::MissingRequiredArgument</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.required_if_eq_any" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3271-3278">source</a></span><h4 class="code-header">pub fn <a href="#method.required_if_eq_any" class="fnname">required_if_eq_any</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;ifs: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = (impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Id.html" title="struct clap::Id">Id</a>&gt;, impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="builder/struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;)&gt;<br>) -&gt; Self</h4></section></summary><div class="docblock"><p>Specify this argument is <a href="builder/struct.Arg.html#method.required">required</a> based on multiple conditions.</p>
<p>The conditions are set up in a <code>(arg, val)</code> style tuple. The requirement will only become
valid if one of the specified <code>arg</code>s value equals its corresponding <code>val</code>.</p>
<h5 id="examples-48"><a href="#examples-48">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">required_if_eq_any</span>([
(<span class="string">&quot;extra&quot;</span>, <span class="string">&quot;val&quot;</span>),
(<span class="string">&quot;option&quot;</span>, <span class="string">&quot;spec&quot;</span>)
])</code></pre></div>
<p>Setting <code>Arg::required_if_eq_any([(arg, val)])</code> makes this arg required if any of the <code>arg</code>s
are used at runtime and its corresponding value is equal to <code>val</code>. If the <code>arg</code>s value is
anything other than <code>val</code>, this argument isnt required.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">required_if_eq_any</span>([
(<span class="string">&quot;extra&quot;</span>, <span class="string">&quot;val&quot;</span>),
(<span class="string">&quot;option&quot;</span>, <span class="string">&quot;spec&quot;</span>)
])
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;extra&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;extra&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;option&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;option&quot;</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--option&quot;</span>, <span class="string">&quot;other&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_ok</span>()); <span class="comment">// We didn&#39;t use --option=spec, or --extra=val so &quot;cfg&quot; isn&#39;t required</span></code></pre></div>
<p>Setting <code>Arg::required_if_eq_any([(arg, val)])</code> and having any of the <code>arg</code>s used with its
value of <code>val</code> but <em>not</em> using this arg is an error.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">required_if_eq_any</span>([
(<span class="string">&quot;extra&quot;</span>, <span class="string">&quot;val&quot;</span>),
(<span class="string">&quot;option&quot;</span>, <span class="string">&quot;spec&quot;</span>)
])
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;extra&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;extra&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;option&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;option&quot;</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--option&quot;</span>, <span class="string">&quot;spec&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_err</span>());
<span class="macro">assert_eq!</span>(<span class="ident">res</span>.<span class="ident">unwrap_err</span>().<span class="ident">kind</span>(), <span class="ident">ErrorKind::MissingRequiredArgument</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.required_if_eq_all" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3352-3359">source</a></span><h4 class="code-header">pub fn <a href="#method.required_if_eq_all" class="fnname">required_if_eq_all</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;ifs: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = (impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Id.html" title="struct clap::Id">Id</a>&gt;, impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="builder/struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;)&gt;<br>) -&gt; Self</h4></section></summary><div class="docblock"><p>Specify this argument is <a href="builder/struct.Arg.html#method.required">required</a> based on multiple conditions.</p>
<p>The conditions are set up in a <code>(arg, val)</code> style tuple. The requirement will only become
valid if every one of the specified <code>arg</code>s value equals its corresponding <code>val</code>.</p>
<h5 id="examples-49"><a href="#examples-49">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">required_if_eq_all</span>([
(<span class="string">&quot;extra&quot;</span>, <span class="string">&quot;val&quot;</span>),
(<span class="string">&quot;option&quot;</span>, <span class="string">&quot;spec&quot;</span>)
])</code></pre></div>
<p>Setting <code>Arg::required_if_eq_all([(arg, val)])</code> makes this arg required if all of the <code>arg</code>s
are used at runtime and every value is equal to its corresponding <code>val</code>. If the <code>arg</code>s value is
anything other than <code>val</code>, this argument isnt required.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">required_if_eq_all</span>([
(<span class="string">&quot;extra&quot;</span>, <span class="string">&quot;val&quot;</span>),
(<span class="string">&quot;option&quot;</span>, <span class="string">&quot;spec&quot;</span>)
])
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;extra&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;extra&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;option&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;option&quot;</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--option&quot;</span>, <span class="string">&quot;spec&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_ok</span>()); <span class="comment">// We didn&#39;t use --option=spec --extra=val so &quot;cfg&quot; isn&#39;t required</span></code></pre></div>
<p>Setting <code>Arg::required_if_eq_all([(arg, val)])</code> and having all of the <code>arg</code>s used with its
value of <code>val</code> but <em>not</em> using this arg is an error.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">required_if_eq_all</span>([
(<span class="string">&quot;extra&quot;</span>, <span class="string">&quot;val&quot;</span>),
(<span class="string">&quot;option&quot;</span>, <span class="string">&quot;spec&quot;</span>)
])
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;extra&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;extra&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;option&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">long</span>(<span class="string">&quot;option&quot;</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--extra&quot;</span>, <span class="string">&quot;val&quot;</span>, <span class="string">&quot;--option&quot;</span>, <span class="string">&quot;spec&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_err</span>());
<span class="macro">assert_eq!</span>(<span class="ident">res</span>.<span class="ident">unwrap_err</span>().<span class="ident">kind</span>(), <span class="ident">ErrorKind::MissingRequiredArgument</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.requires_if" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3417-3420">source</a></span><h4 class="code-header">pub fn <a href="#method.requires_if" class="fnname">requires_if</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;val: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="builder/enum.ArgPredicate.html" title="enum clap::builder::ArgPredicate">ArgPredicate</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;arg_id: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Id.html" title="struct clap::Id">Id</a>&gt;<br>) -&gt; Self</h4></section></summary><div class="docblock"><p>Require another argument if this arg matches the <a href="builder/enum.ArgPredicate.html" title="ArgPredicate"><code>ArgPredicate</code></a></p>
<p>This method takes <code>value, another_arg</code> pair. At runtime, clap will check
if this arg (<code>self</code>) matches the <a href="builder/enum.ArgPredicate.html" title="ArgPredicate"><code>ArgPredicate</code></a>.
If it does, <code>another_arg</code> will be marked as required.</p>
<h5 id="examples-50"><a href="#examples-50">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">requires_if</span>(<span class="string">&quot;val&quot;</span>, <span class="string">&quot;arg&quot;</span>)</code></pre></div>
<p>Setting <code>Arg::requires_if(val, arg)</code> requires that the <code>arg</code> be used at runtime if the
defining arguments value is equal to <code>val</code>. If the defining argument is anything other than
<code>val</code>, the other argument isnt required.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">requires_if</span>(<span class="string">&quot;my.cfg&quot;</span>, <span class="string">&quot;other&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;other&quot;</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--config&quot;</span>, <span class="string">&quot;some.cfg&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_ok</span>()); <span class="comment">// We didn&#39;t use --config=my.cfg, so other wasn&#39;t required</span></code></pre></div>
<p>Setting <code>Arg::requires_if(val, arg)</code> and setting the value to <code>val</code> but <em>not</em> supplying
<code>arg</code> is an error.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">requires_if</span>(<span class="string">&quot;my.cfg&quot;</span>, <span class="string">&quot;input&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;input&quot;</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--config&quot;</span>, <span class="string">&quot;my.cfg&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_err</span>());
<span class="macro">assert_eq!</span>(<span class="ident">res</span>.<span class="ident">unwrap_err</span>().<span class="ident">kind</span>(), <span class="ident">ErrorKind::MissingRequiredArgument</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.requires_ifs" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3493-3500">source</a></span><h4 class="code-header">pub fn <a href="#method.requires_ifs" class="fnname">requires_ifs</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;ifs: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = (impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="builder/enum.ArgPredicate.html" title="enum clap::builder::ArgPredicate">ArgPredicate</a>&gt;, impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Id.html" title="struct clap::Id">Id</a>&gt;)&gt;<br>) -&gt; Self</h4></section></summary><div class="docblock"><p>Allows multiple conditional requirements.</p>
<p>The requirement will only become valid if this args value matches the
<a href="builder/enum.ArgPredicate.html" title="ArgPredicate"><code>ArgPredicate</code></a>.</p>
<h5 id="examples-51"><a href="#examples-51">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">requires_ifs</span>([
(<span class="string">&quot;val&quot;</span>, <span class="string">&quot;arg&quot;</span>),
(<span class="string">&quot;other_val&quot;</span>, <span class="string">&quot;arg2&quot;</span>),
])</code></pre></div>
<p>Setting <code>Arg::requires_ifs([&quot;val&quot;, &quot;arg&quot;])</code> requires that the <code>arg</code> be used at runtime if the
defining arguments value is equal to <code>val</code>. If the defining arguments value is anything other
than <code>val</code>, <code>arg</code> isnt required.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">requires_ifs</span>([
(<span class="string">&quot;special.conf&quot;</span>, <span class="string">&quot;opt&quot;</span>),
(<span class="string">&quot;other.conf&quot;</span>, <span class="string">&quot;other&quot;</span>),
])
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;opt&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;option&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;other&quot;</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--config&quot;</span>, <span class="string">&quot;special.conf&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_err</span>()); <span class="comment">// We used --config=special.conf so --option &lt;val&gt; is required</span>
<span class="macro">assert_eq!</span>(<span class="ident">res</span>.<span class="ident">unwrap_err</span>().<span class="ident">kind</span>(), <span class="ident">ErrorKind::MissingRequiredArgument</span>);</code></pre></div>
<p>Setting <code>Arg::requires_ifs</code> with <a href="builder/enum.ArgPredicate.html#variant.IsPresent" title="ArgPredicate::IsPresent"><code>ArgPredicate::IsPresent</code></a> and <em>not</em> supplying all the
arguments is an error.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">requires_ifs</span>([
(<span class="ident">ArgPredicate::IsPresent</span>, <span class="string">&quot;input&quot;</span>),
(<span class="ident">ArgPredicate::IsPresent</span>, <span class="string">&quot;output&quot;</span>),
])
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;input&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;output&quot;</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--config&quot;</span>, <span class="string">&quot;file.conf&quot;</span>, <span class="string">&quot;in.txt&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_err</span>());
<span class="comment">// We didn&#39;t use output</span>
<span class="macro">assert_eq!</span>(<span class="ident">res</span>.<span class="ident">unwrap_err</span>().<span class="ident">kind</span>(), <span class="ident">ErrorKind::MissingRequiredArgument</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.conflicts_with" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3558-3565">source</a></span><h4 class="code-header">pub fn <a href="#method.conflicts_with" class="fnname">conflicts_with</a>(self, arg_id: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.Id.html" title="struct clap::Id">Id</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>This argument is mutually exclusive with the specified argument.</p>
<p><strong>NOTE:</strong> Conflicting rules take precedence over being required by default. Conflict rules
only need to be set for one of the two arguments, they do not need to be set for each.</p>
<p><strong>NOTE:</strong> Defining a conflict is two-way, but does <em>not</em> need to defined for both arguments
(i.e. if A conflicts with B, defining A.conflicts_with(B) is sufficient. You do not
need to also do B.conflicts_with(A))</p>
<p><strong>NOTE:</strong> <a href="builder/struct.Arg.html#method.conflicts_with_all"><code>Arg::conflicts_with_all(names)</code></a> allows specifying an argument which conflicts with more than one argument.</p>
<p><strong>NOTE</strong> <a href="builder/struct.Arg.html#method.exclusive"><code>Arg::exclusive(true)</code></a> allows specifying an argument which conflicts with every other argument.</p>
<p><strong>NOTE:</strong> All arguments implicitly conflict with themselves.</p>
<h5 id="examples-52"><a href="#examples-52">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">conflicts_with</span>(<span class="string">&quot;debug&quot;</span>)</code></pre></div>
<p>Setting conflicting argument, and having both arguments present at runtime is an error.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">conflicts_with</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::SetTrue</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--debug&quot;</span>, <span class="string">&quot;--config&quot;</span>, <span class="string">&quot;file.conf&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_err</span>());
<span class="macro">assert_eq!</span>(<span class="ident">res</span>.<span class="ident">unwrap_err</span>().<span class="ident">kind</span>(), <span class="ident">ErrorKind::ArgumentConflict</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.conflicts_with_all" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3612-3615">source</a></span><h4 class="code-header">pub fn <a href="#method.conflicts_with_all" class="fnname">conflicts_with_all</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;names: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Id.html" title="struct clap::Id">Id</a>&gt;&gt;<br>) -&gt; Self</h4></section></summary><div class="docblock"><p>This argument is mutually exclusive with the specified arguments.</p>
<p>See <a href="builder/struct.Arg.html#method.conflicts_with"><code>Arg::conflicts_with</code></a>.</p>
<p><strong>NOTE:</strong> Conflicting rules take precedence over being required by default. Conflict rules
only need to be set for one of the two arguments, they do not need to be set for each.</p>
<p><strong>NOTE:</strong> Defining a conflict is two-way, but does <em>not</em> need to defined for both arguments
(i.e. if A conflicts with B, defining A.conflicts_with(B) is sufficient. You do not need
need to also do B.conflicts_with(A))</p>
<p><strong>NOTE:</strong> <a href="builder/struct.Arg.html#method.exclusive"><code>Arg::exclusive(true)</code></a> allows specifying an argument which conflicts with every other argument.</p>
<h5 id="examples-53"><a href="#examples-53">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="ident">Arg::new</span>(<span class="string">&quot;config&quot;</span>)
.<span class="ident">conflicts_with_all</span>([<span class="string">&quot;debug&quot;</span>, <span class="string">&quot;input&quot;</span>])</code></pre></div>
<p>Setting conflicting argument, and having any of the arguments present at runtime with a
conflicting argument is an error.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;cfg&quot;</span>)
.<span class="ident">action</span>(<span class="ident">ArgAction::Set</span>)
.<span class="ident">conflicts_with_all</span>([<span class="string">&quot;debug&quot;</span>, <span class="string">&quot;input&quot;</span>])
.<span class="ident">long</span>(<span class="string">&quot;config&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;debug&quot;</span>)
.<span class="ident">long</span>(<span class="string">&quot;debug&quot;</span>))
.<span class="ident">arg</span>(<span class="ident">Arg::new</span>(<span class="string">&quot;input&quot;</span>))
.<span class="ident">try_get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;--config&quot;</span>, <span class="string">&quot;file.conf&quot;</span>, <span class="string">&quot;file.txt&quot;</span>
]);
<span class="macro">assert!</span>(<span class="ident">res</span>.<span class="ident">is_err</span>());
<span class="macro">assert_eq!</span>(<span class="ident">res</span>.<span class="ident">unwrap_err</span>().<span class="ident">kind</span>(), <span class="ident">ErrorKind::ArgumentConflict</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.overrides_with" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3648-3655">source</a></span><h4 class="code-header">pub fn <a href="#method.overrides_with" class="fnname">overrides_with</a>(self, arg_id: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.Id.html" title="struct clap::Id">Id</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Sets an overridable argument.</p>
<p>i.e. this argument and the following argument
will override each other in POSIX style (whichever argument was specified at runtime
<strong>last</strong> “wins”)</p>
<p><strong>NOTE:</strong> When an argument is overridden it is essentially as if it never was used, any
conflicts, requirements, etc. are evaluated <strong>after</strong> all “overrides” have been removed</p>
<p><strong>NOTE:</strong> Overriding an argument implies they <a href="builder/struct.Arg.html#method.conflicts_with" title="Arg::conflicts_with">conflict</a>.</p>
<h5 id="examples-54"><a href="#examples-54">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="macro">arg!</span>(<span class="op">-</span><span class="ident">f</span> <span class="op">-</span><span class="op">-</span><span class="ident">flag</span> <span class="string">&quot;some flag&quot;</span>)
.<span class="ident">conflicts_with</span>(<span class="string">&quot;debug&quot;</span>))
.<span class="ident">arg</span>(<span class="macro">arg!</span>(<span class="op">-</span><span class="ident">d</span> <span class="op">-</span><span class="op">-</span><span class="ident">debug</span> <span class="string">&quot;other flag&quot;</span>))
.<span class="ident">arg</span>(<span class="macro">arg!</span>(<span class="op">-</span><span class="ident">c</span> <span class="op">-</span><span class="op">-</span><span class="ident">color</span> <span class="string">&quot;third flag&quot;</span>)
.<span class="ident">overrides_with</span>(<span class="string">&quot;flag&quot;</span>))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;-f&quot;</span>, <span class="string">&quot;-d&quot;</span>, <span class="string">&quot;-c&quot;</span>]);
<span class="comment">// ^~~~~~~~~~~~^~~~~ flag is overridden by color</span>
<span class="macro">assert!</span>(<span class="kw-2">*</span><span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">bool</span><span class="op">&gt;</span>(<span class="string">&quot;color&quot;</span>).<span class="ident">unwrap</span>());
<span class="macro">assert!</span>(<span class="kw-2">*</span><span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">bool</span><span class="op">&gt;</span>(<span class="string">&quot;debug&quot;</span>).<span class="ident">unwrap</span>()); <span class="comment">// even though flag conflicts with debug, it&#39;s as if flag</span>
<span class="comment">// was never used because it was overridden with color</span>
<span class="macro">assert!</span>(<span class="op">!</span><span class="kw-2">*</span><span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">bool</span><span class="op">&gt;</span>(<span class="string">&quot;flag&quot;</span>).<span class="ident">unwrap</span>());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.overrides_with_all" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3688-3691">source</a></span><h4 class="code-header">pub fn <a href="#method.overrides_with_all" class="fnname">overrides_with_all</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;names: impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Id.html" title="struct clap::Id">Id</a>&gt;&gt;<br>) -&gt; Self</h4></section></summary><div class="docblock"><p>Sets multiple mutually overridable arguments by name.</p>
<p>i.e. this argument and the following argument will override each other in POSIX style
(whichever argument was specified at runtime <strong>last</strong> “wins”)</p>
<p><strong>NOTE:</strong> When an argument is overridden it is essentially as if it never was used, any
conflicts, requirements, etc. are evaluated <strong>after</strong> all “overrides” have been removed</p>
<p><strong>NOTE:</strong> Overriding an argument implies they <a href="builder/struct.Arg.html#method.conflicts_with_all" title="Arg::conflicts_with_all">conflict</a>.</p>
<h5 id="examples-55"><a href="#examples-55">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">m</span> <span class="op">=</span> <span class="ident">Command::new</span>(<span class="string">&quot;prog&quot;</span>)
.<span class="ident">arg</span>(<span class="macro">arg!</span>(<span class="op">-</span><span class="ident">f</span> <span class="op">-</span><span class="op">-</span><span class="ident">flag</span> <span class="string">&quot;some flag&quot;</span>)
.<span class="ident">conflicts_with</span>(<span class="string">&quot;color&quot;</span>))
.<span class="ident">arg</span>(<span class="macro">arg!</span>(<span class="op">-</span><span class="ident">d</span> <span class="op">-</span><span class="op">-</span><span class="ident">debug</span> <span class="string">&quot;other flag&quot;</span>))
.<span class="ident">arg</span>(<span class="macro">arg!</span>(<span class="op">-</span><span class="ident">c</span> <span class="op">-</span><span class="op">-</span><span class="ident">color</span> <span class="string">&quot;third flag&quot;</span>)
.<span class="ident">overrides_with_all</span>([<span class="string">&quot;flag&quot;</span>, <span class="string">&quot;debug&quot;</span>]))
.<span class="ident">get_matches_from</span>(<span class="macro">vec!</span>[
<span class="string">&quot;prog&quot;</span>, <span class="string">&quot;-f&quot;</span>, <span class="string">&quot;-d&quot;</span>, <span class="string">&quot;-c&quot;</span>]);
<span class="comment">// ^~~~~~^~~~~~~~~ flag and debug are overridden by color</span>
<span class="macro">assert!</span>(<span class="kw-2">*</span><span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">bool</span><span class="op">&gt;</span>(<span class="string">&quot;color&quot;</span>).<span class="ident">unwrap</span>()); <span class="comment">// even though flag conflicts with color, it&#39;s as if flag</span>
<span class="comment">// and debug were never used because they were overridden</span>
<span class="comment">// with color</span>
<span class="macro">assert!</span>(<span class="op">!</span><span class="kw-2">*</span><span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">bool</span><span class="op">&gt;</span>(<span class="string">&quot;debug&quot;</span>).<span class="ident">unwrap</span>());
<span class="macro">assert!</span>(<span class="op">!</span><span class="kw-2">*</span><span class="ident">m</span>.<span class="ident">get_one</span>::<span class="op">&lt;</span><span class="ident">bool</span><span class="op">&gt;</span>(<span class="string">&quot;flag&quot;</span>).<span class="ident">unwrap</span>());</code></pre></div>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Arg-4" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3695-4051">source</a></span><a href="#impl-Arg-4" class="anchor"></a><h3 class="code-header in-band">impl <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h3></section></summary><div class="docblock"><h4 id="reflection"><a href="#reflection">Reflection</a></h4></div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_id" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3698-3700">source</a></span><h4 class="code-header">pub fn <a href="#method.get_id" class="fnname">get_id</a>(&amp;self) -&gt; &amp;<a class="struct" href="struct.Id.html" title="struct clap::Id">Id</a></h4></section></summary><div class="docblock"><p>Get the name of the argument</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_help" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3704-3706">source</a></span><h4 class="code-header">pub fn <a href="#method.get_help" class="fnname">get_help</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;</h4></section></summary><div class="docblock"><p>Get the help specified for this argument, if any</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_long_help" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3719-3721">source</a></span><h4 class="code-header">pub fn <a href="#method.get_long_help" class="fnname">get_long_help</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;</h4></section></summary><div class="docblock"><p>Get the long help specified for this argument, if any</p>
<h5 id="examples-56"><a href="#examples-56">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">arg</span> <span class="op">=</span> <span class="ident">Arg::new</span>(<span class="string">&quot;foo&quot;</span>).<span class="ident">long_help</span>(<span class="string">&quot;long help&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="string">&quot;long help&quot;</span>.<span class="ident">to_owned</span>()), <span class="ident">arg</span>.<span class="ident">get_long_help</span>().<span class="ident">map</span>(<span class="op">|</span><span class="ident">s</span><span class="op">|</span> <span class="ident">s</span>.<span class="ident">to_string</span>()));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_help_heading" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3725-3730">source</a></span><h4 class="code-header">pub fn <a href="#method.get_help_heading" class="fnname">get_help_heading</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>Get the help heading specified for this argument, if any</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_short" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3734-3736">source</a></span><h4 class="code-header">pub fn <a href="#method.get_short" class="fnname">get_short</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.char.html">char</a>&gt;</h4></section></summary><div class="docblock"><p>Get the short option name for this argument, if any</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_visible_short_aliases" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3740-3752">source</a></span><h4 class="code-header">pub fn <a href="#method.get_visible_short_aliases" class="fnname">get_visible_short_aliases</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.char.html">char</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Get visible short aliases for this argument, if any</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_all_short_aliases" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3756-3762">source</a></span><h4 class="code-header">pub fn <a href="#method.get_all_short_aliases" class="fnname">get_all_short_aliases</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.char.html">char</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Get <em>all</em> short aliases for this argument, if any, both visible and hidden.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_short_and_visible_aliases" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3766-3775">source</a></span><h4 class="code-header">pub fn <a href="#method.get_short_and_visible_aliases" class="fnname">get_short_and_visible_aliases</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.char.html">char</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Get the short option name and its visible aliases, if any</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_long" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3779-3781">source</a></span><h4 class="code-header">pub fn <a href="#method.get_long" class="fnname">get_long</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>Get the long option name for this argument, if any</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_visible_aliases" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3785-3796">source</a></span><h4 class="code-header">pub fn <a href="#method.get_visible_aliases" class="fnname">get_visible_aliases</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.str.html">str</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Get visible aliases for this argument, if any</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_all_aliases" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3800-3806">source</a></span><h4 class="code-header">pub fn <a href="#method.get_all_aliases" class="fnname">get_all_aliases</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.str.html">str</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Get <em>all</em> aliases for this argument, if any, both visible and hidden.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_long_and_visible_aliases" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3810-3819">source</a></span><h4 class="code-header">pub fn <a href="#method.get_long_and_visible_aliases" class="fnname">get_long_and_visible_aliases</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.str.html">str</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Get the long option name and its visible aliases, if any</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_possible_values" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3823-3832">source</a></span><h4 class="code-header">pub fn <a href="#method.get_possible_values" class="fnname">get_possible_values</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="builder/struct.PossibleValue.html" title="struct clap::builder::PossibleValue">PossibleValue</a>&gt;</h4></section></summary><div class="docblock"><p>Get the names of possible values for this argument. Only useful for user
facing applications, such as building help messages or man files</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_value_names" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3836-3842">source</a></span><h4 class="code-header">pub fn <a href="#method.get_value_names" class="fnname">get_value_names</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;[<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>]&gt;</h4></section></summary><div class="docblock"><p>Get the names of values for this argument.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_num_args" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3846-3848">source</a></span><h4 class="code-header">pub fn <a href="#method.get_num_args" class="fnname">get_num_args</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="builder/struct.ValueRange.html" title="struct clap::builder::ValueRange">ValueRange</a>&gt;</h4></section></summary><div class="docblock"><p>Get the number of values for this argument.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_value_delimiter" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3857-3859">source</a></span><h4 class="code-header">pub fn <a href="#method.get_value_delimiter" class="fnname">get_value_delimiter</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.char.html">char</a>&gt;</h4></section></summary><div class="docblock"><p>Get the delimiter between multiple values</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_index" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3863-3865">source</a></span><h4 class="code-header">pub fn <a href="#method.get_index" class="fnname">get_index</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.usize.html">usize</a>&gt;</h4></section></summary><div class="docblock"><p>Get the index of this argument, if any</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_value_hint" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3868-3881">source</a></span><h4 class="code-header">pub fn <a href="#method.get_value_hint" class="fnname">get_value_hint</a>(&amp;self) -&gt; <a class="enum" href="builder/enum.ValueHint.html" title="enum clap::builder::ValueHint">ValueHint</a></h4></section></summary><div class="docblock"><p>Get the value hint of this argument</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_default_values" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3907-3909">source</a></span><h4 class="code-header">pub fn <a href="#method.get_default_values" class="fnname">get_default_values</a>(&amp;self) -&gt; &amp;[<a class="struct" href="builder/struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>]</h4></section></summary><div class="docblock"><p>Get the default values specified for this argument, if any</p>
<h5 id="examples-57"><a href="#examples-57">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">arg</span> <span class="op">=</span> <span class="ident">Arg::new</span>(<span class="string">&quot;foo&quot;</span>).<span class="ident">default_value</span>(<span class="string">&quot;default value&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="ident">arg</span>.<span class="ident">get_default_values</span>(), <span class="kw-2">&amp;</span>[<span class="string">&quot;default value&quot;</span>]);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_positional" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3923-3925">source</a></span><h4 class="code-header">pub fn <a href="#method.is_positional" class="fnname">is_positional</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Checks whether this argument is a positional or not.</p>
<h5 id="examples-58"><a href="#examples-58">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">arg</span> <span class="op">=</span> <span class="ident">Arg::new</span>(<span class="string">&quot;foo&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="ident">arg</span>.<span class="ident">is_positional</span>(), <span class="bool-val">true</span>);
<span class="kw">let</span> <span class="ident">arg</span> <span class="op">=</span> <span class="ident">Arg::new</span>(<span class="string">&quot;foo&quot;</span>).<span class="ident">long</span>(<span class="string">&quot;foo&quot;</span>);
<span class="macro">assert_eq!</span>(<span class="ident">arg</span>.<span class="ident">is_positional</span>(), <span class="bool-val">false</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_required_set" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3928-3930">source</a></span><h4 class="code-header">pub fn <a href="#method.is_required_set" class="fnname">is_required_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Reports whether <a href="builder/struct.Arg.html#method.required" title="Arg::required"><code>Arg::required</code></a> is set</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_allow_hyphen_values_set" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3941-3943">source</a></span><h4 class="code-header">pub fn <a href="#method.is_allow_hyphen_values_set" class="fnname">is_allow_hyphen_values_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="builder/struct.Arg.html#method.allow_hyphen_values" title="Arg::allow_hyphen_values"><code>Arg::allow_hyphen_values</code></a> is set</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_allow_negative_numbers_set" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3946-3948">source</a></span><h4 class="code-header">pub fn <a href="#method.is_allow_negative_numbers_set" class="fnname">is_allow_negative_numbers_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="builder/struct.Arg.html#method.allow_negative_numbers" title="Arg::allow_negative_numbers"><code>Arg::allow_negative_numbers</code></a> is set</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_action" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3951-3954">source</a></span><h4 class="code-header">pub fn <a href="#method.get_action" class="fnname">get_action</a>(&amp;self) -&gt; &amp;<a class="enum" href="builder/enum.ArgAction.html" title="enum clap::builder::ArgAction">ArgAction</a></h4></section></summary><div class="docblock"><p>Behavior when parsing the argument</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.get_value_parser" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3971-3978">source</a></span><h4 class="code-header">pub fn <a href="#method.get_value_parser" class="fnname">get_value_parser</a>(&amp;self) -&gt; &amp;<a class="struct" href="builder/struct.ValueParser.html" title="struct clap::builder::ValueParser">ValueParser</a></h4></section></summary><div class="docblock"><p>Configured parser for argument values</p>
<h5 id="example"><a href="#example">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let</span> <span class="ident">cmd</span> <span class="op">=</span> <span class="ident">clap::Command::new</span>(<span class="string">&quot;raw&quot;</span>)
.<span class="ident">arg</span>(
<span class="ident">clap::Arg::new</span>(<span class="string">&quot;port&quot;</span>)
.<span class="ident">value_parser</span>(<span class="macro">clap::value_parser!</span>(<span class="ident">usize</span>))
);
<span class="kw">let</span> <span class="ident">value_parser</span> <span class="op">=</span> <span class="ident">cmd</span>.<span class="ident">get_arguments</span>()
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">a</span><span class="op">|</span> <span class="ident">a</span>.<span class="ident">get_id</span>() <span class="op">==</span> <span class="string">&quot;port&quot;</span>).<span class="ident">unwrap</span>()
.<span class="ident">get_value_parser</span>();
<span class="macro">println!</span>(<span class="string">&quot;{:?}&quot;</span>, <span class="ident">value_parser</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_global_set" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3981-3983">source</a></span><h4 class="code-header">pub fn <a href="#method.is_global_set" class="fnname">is_global_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="builder/struct.Arg.html#method.global" title="Arg::global"><code>Arg::global</code></a> is set</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_next_line_help_set" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3986-3988">source</a></span><h4 class="code-header">pub fn <a href="#method.is_next_line_help_set" class="fnname">is_next_line_help_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="builder/struct.Arg.html#method.next_line_help" title="Arg::next_line_help"><code>Arg::next_line_help</code></a> is set</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_hide_set" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3991-3993">source</a></span><h4 class="code-header">pub fn <a href="#method.is_hide_set" class="fnname">is_hide_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="builder/struct.Arg.html#method.hide" title="Arg::hide"><code>Arg::hide</code></a> is set</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_hide_default_value_set" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#3996-3998">source</a></span><h4 class="code-header">pub fn <a href="#method.is_hide_default_value_set" class="fnname">is_hide_default_value_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="builder/struct.Arg.html#method.hide_default_value" title="Arg::hide_default_value"><code>Arg::hide_default_value</code></a> is set</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_hide_possible_values_set" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4001-4003">source</a></span><h4 class="code-header">pub fn <a href="#method.is_hide_possible_values_set" class="fnname">is_hide_possible_values_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="builder/struct.Arg.html#method.hide_possible_values" title="Arg::hide_possible_values"><code>Arg::hide_possible_values</code></a> is set</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_hide_short_help_set" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4018-4020">source</a></span><h4 class="code-header">pub fn <a href="#method.is_hide_short_help_set" class="fnname">is_hide_short_help_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="builder/struct.Arg.html#method.hide_short_help" title="Arg::hide_short_help"><code>Arg::hide_short_help</code></a> is set</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_hide_long_help_set" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4023-4025">source</a></span><h4 class="code-header">pub fn <a href="#method.is_hide_long_help_set" class="fnname">is_hide_long_help_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="builder/struct.Arg.html#method.hide_long_help" title="Arg::hide_long_help"><code>Arg::hide_long_help</code></a> is set</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_require_equals_set" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4028-4030">source</a></span><h4 class="code-header">pub fn <a href="#method.is_require_equals_set" class="fnname">is_require_equals_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="builder/struct.Arg.html#method.require_equals" title="Arg::require_equals"><code>Arg::require_equals</code></a> is set</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_exclusive_set" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4033-4035">source</a></span><h4 class="code-header">pub fn <a href="#method.is_exclusive_set" class="fnname">is_exclusive_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Reports whether <a href="builder/struct.Arg.html#method.exclusive" title="Arg::exclusive"><code>Arg::exclusive</code></a> is set</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_trailing_var_arg_set" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4038-4040">source</a></span><h4 class="code-header">pub fn <a href="#method.is_trailing_var_arg_set" class="fnname">is_trailing_var_arg_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="builder/struct.Arg.html#method.trailing_var_arg" title="Arg::trailing_var_arg"><code>Arg::trailing_var_arg</code></a> is set</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_last_set" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4043-4045">source</a></span><h4 class="code-header">pub fn <a href="#method.is_last_set" class="fnname">is_last_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Reports whether <a href="builder/struct.Arg.html#method.last" title="Arg::last"><code>Arg::last</code></a> is set</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.is_ignore_case_set" class="method has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4048-4050">source</a></span><h4 class="code-header">pub fn <a href="#method.is_ignore_case_set" class="fnname">is_ignore_case_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Reports whether <a href="builder/struct.Arg.html#method.ignore_case" title="Arg::ignore_case"><code>Arg::ignore_case</code></a> is set</p>
</div></details></div></details><section id="impl-Arg-5" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4054-4234">source</a></span><a href="#impl-Arg-5" class="anchor"></a><h3 class="code-header in-band">impl <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h3></section><div class="item-info"><div class="stab empty-impl">This impl block contains no items.</div>
</div><div class="docblock"><h4 id="internally-used-only"><a href="#internally-used-only">Internally used only</a></h4></div></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Clone-for-Arg" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#53">source</a></span><a href="#impl-Clone-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#53">source</a></span><a href="#method.clone" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/clone/trait.Clone.html#tymethod.clone" class="fnname">clone</a>(&amp;self) -&gt; <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h4></section></summary><div class='docblock'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/1.64.0/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/clone.rs.html#132-134">source</a></span><a href="#method.clone_from" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/clone/trait.Clone.html#method.clone_from" class="fnname">clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.reference.html">&amp;</a>Self)</h4></section></summary><div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/1.64.0/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Debug-for-Arg" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4268-4309">source</a></span><a href="#impl-Debug-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fmt-1" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4269-4308">source</a></span><a href="#method.fmt-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.64.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.64.0/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section></summary><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.64.0/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Default-for-Arg" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#53">source</a></span><a href="#impl-Default-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.default" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#53">source</a></span><a href="#method.default" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/default/trait.Default.html#tymethod.default" class="fnname">default</a>() -&gt; <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h4></section></summary><div class='docblock'><p>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.64.0/core/default/trait.Default.html#tymethod.default">Read more</a></p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Display-for-Arg" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4262-4266">source</a></span><a href="#impl-Display-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4263-4265">source</a></span><a href="#method.fmt" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/fmt/trait.Display.html#tymethod.fmt" class="fnname">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.64.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.64.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.64.0/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-From%3C%26Arg%3E-for-Arg" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4236-4240">source</a></span><a href="#impl-From%3C%26Arg%3E-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;&amp;<a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a>&gt; for <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4237-4239">source</a></span><a href="#method.from" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(a: &amp;<a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a>) -&gt; Self</h4></section></summary><div class='docblock'><p>Converts to this type from the input type.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Ord-for-Arg" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4254-4258">source</a></span><a href="#impl-Ord-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> for <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.cmp" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4255-4257">source</a></span><a href="#method.cmp" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.Ord.html#tymethod.cmp" class="fnname">cmp</a>(&amp;self, other: &amp;<a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></h4></section></summary><div class='docblock'><p>This method returns an <a href="https://doc.rust-lang.org/1.64.0/core/cmp/enum.Ordering.html" title="Ordering"><code>Ordering</code></a> between <code>self</code> and <code>other</code>. <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.Ord.html#tymethod.cmp">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.max" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/cmp.rs.html#800-803">source</a></span><a href="#method.max" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.Ord.html#method.max" class="fnname">max</a>(self, other: Self) -&gt; Self</h4></section></summary><div class='docblock'><p>Compares and returns the maximum of two values. <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.Ord.html#method.max">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.min" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/cmp.rs.html#827-830">source</a></span><a href="#method.min" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.Ord.html#method.min" class="fnname">min</a>(self, other: Self) -&gt; Self</h4></section></summary><div class='docblock'><p>Compares and returns the minimum of two values. <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.Ord.html#method.min">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clamp" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="Stable since Rust version 1.50.0">1.50.0</span> · <a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/cmp.rs.html#859-863">source</a></span><a href="#method.clamp" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.Ord.html#method.clamp" class="fnname">clamp</a>(self, min: Self, max: Self) -&gt; Self <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;Self&gt;,&nbsp;</span></h4></section></summary><div class='docblock'><p>Restrict a value to a certain interval. <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.Ord.html#method.clamp">Read more</a></p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CArg%3E-for-Arg" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4242-4246">source</a></span><a href="#impl-PartialEq%3CArg%3E-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a>&gt; for <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.eq" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4243-4245">source</a></span><a href="#method.eq" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.PartialEq.html#tymethod.eq" class="fnname">eq</a>(&amp;self, other: &amp;<a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
by <code>==</code>. <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.ne" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/cmp.rs.html#232">source</a></span><a href="#method.ne" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.PartialEq.html#method.ne" class="fnname">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.reference.html">&amp;</a>Rhs) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'><p>This method tests for <code>!=</code>.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CArg%3E-for-Arg" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4248-4252">source</a></span><a href="#impl-PartialOrd%3CArg%3E-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;<a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a>&gt; for <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.partial_cmp" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4249-4251">source</a></span><a href="#method.partial_cmp" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fnname">partial_cmp</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.reference.html">&amp;</a>Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.64.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>&gt;</h4></section></summary><div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.lt" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/cmp.rs.html#1122">source</a></span><a href="#method.lt" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.PartialOrd.html#method.lt" class="fnname">lt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.reference.html">&amp;</a>Rhs) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.le" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/cmp.rs.html#1141">source</a></span><a href="#method.le" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.PartialOrd.html#method.le" class="fnname">le</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.reference.html">&amp;</a>Rhs) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;=</code>
operator. <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.gt" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/cmp.rs.html#1163">source</a></span><a href="#method.gt" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.PartialOrd.html#method.gt" class="fnname">gt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.reference.html">&amp;</a>Rhs) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code> operator. <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.ge" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/cmp.rs.html#1182">source</a></span><a href="#method.ge" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.PartialOrd.html#method.ge" class="fnname">ge</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.reference.html">&amp;</a>Rhs) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;=</code>
operator. <a href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></p>
</div></details></div></details><section id="impl-Eq-for-Arg" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/clap/builder/arg.rs.html#4260">source</a></span><a href="#impl-Eq-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h3></section></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-Arg" class="impl has-srclink"><a href="#impl-RefUnwindSafe-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl !<a class="trait" href="https://doc.rust-lang.org/1.64.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h3></section><section id="impl-Send-for-Arg" class="impl has-srclink"><a href="#impl-Send-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h3></section><section id="impl-Sync-for-Arg" class="impl has-srclink"><a href="#impl-Sync-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h3></section><section id="impl-Unpin-for-Arg" class="impl has-srclink"><a href="#impl-Unpin-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h3></section><section id="impl-UnwindSafe-for-Arg" class="impl has-srclink"><a href="#impl-UnwindSafe-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl !<a class="trait" href="https://doc.rust-lang.org/1.64.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="builder/struct.Arg.html" title="struct clap::builder::Arg">Arg</a></h3></section></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Any-for-Arg" class="impl has-srclink"><span class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/any.rs.html#203">source</a></span><a href="#impl-Any-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.64.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/any.rs.html#204">source</a></span><a href="#method.type_id" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.64.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.64.0/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-Arg" class="impl has-srclink"><span class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/borrow.rs.html#209">source</a></span><a href="#impl-Borrow%3CT%3E-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/1.64.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/borrow.rs.html#211">source</a></span><a href="#method.borrow" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.reference.html">&amp;</a>T</h4></section></summary><div class='docblock'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.64.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-Arg" class="impl has-srclink"><span class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/borrow.rs.html#218">source</a></span><a href="#impl-BorrowMut%3CT%3E-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/1.64.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/borrow.rs.html#219">source</a></span><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.reference.html">&amp;mut </a>T</h4></section></summary><div class='docblock'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.64.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-Arg" class="impl has-srclink"><span class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/convert/mod.rs.html#557">source</a></span><a href="#impl-From%3CT%3E-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from-1" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/convert/mod.rs.html#559">source</a></span><a href="#method.from-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-Arg" class="impl has-srclink"><span class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/convert/mod.rs.html#541">source</a></span><a href="#impl-Into%3CU%3E-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,&nbsp;</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/convert/mod.rs.html#549">source</a></span><a href="#method.into" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code><a href="https://doc.rust-lang.org/1.64.0/core/convert/trait.From.html" title="From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ToOwned-for-Arg" class="impl has-srclink"><span class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/alloc/borrow.rs.html#83">source</a></span><a href="#impl-ToOwned-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.64.0/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,&nbsp;</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Owned" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.64.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'><p>The resulting type after obtaining ownership.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/alloc/borrow.rs.html#88">source</a></span><a href="#method.to_owned" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fnname">to_owned</a>(&amp;self) -&gt; T</h4></section></summary><div class='docblock'><p>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/1.64.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/alloc/borrow.rs.html#92">source</a></span><a href="#method.clone_into" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fnname">clone_into</a>(&amp;self, target: <a class="primitive" href="https://doc.rust-lang.org/1.64.0/std/primitive.reference.html">&amp;mut </a>T)</h4></section></summary><div class='docblock'><p>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/1.64.0/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ToString-for-Arg" class="impl has-srclink"><span class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/alloc/string.rs.html#2479">source</a></span><a href="#impl-ToString-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.64.0/alloc/string/trait.ToString.html" title="trait alloc::string::ToString">ToString</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.64.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.to_string" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/alloc/string.rs.html#2485">source</a></span><a href="#method.to_string" class="anchor"></a><h4 class="code-header">default fn <a href="https://doc.rust-lang.org/1.64.0/alloc/string/trait.ToString.html#tymethod.to_string" class="fnname">to_string</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.64.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class='docblock'><p>Converts the given value to a <code>String</code>. <a href="https://doc.rust-lang.org/1.64.0/alloc/string/trait.ToString.html#tymethod.to_string">Read more</a></p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-Arg" class="impl has-srclink"><span class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/convert/mod.rs.html#598">source</a></span><a href="#impl-TryFrom%3CU%3E-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,&nbsp;</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.64.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/convert/mod.rs.html#604">source</a></span><a href="#method.try_from" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'><p>Performs the conversion.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-Arg" class="impl has-srclink"><span class="rightside"><a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/convert/mod.rs.html#583">source</a></span><a href="#impl-TryInto%3CU%3E-for-Arg" class="anchor"></a><h3 class="code-header in-band">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,&nbsp;</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.64.0/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'><p>The type returned in the event of a conversion error.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/1.64.0/src/core/convert/mod.rs.html#589">source</a></span><a href="#method.try_into" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.64.0/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.64.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.64.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'><p>Performs the conversion.</p>
</div></details></div></details></div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="clap" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0 (a55dd71d5 2022-09-19)" ></div></body></html>