edlang/clap/builder/struct.Arg.html
2024-08-01 07:04:26 +00:00

2090 lines
267 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."><title>Arg in clap::builder - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="clap" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0 (051478957 2024-07-21)" data-channel="1.80.0" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.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" title="show sidebar"></button><a class="logo-container" href="../../clap/index.html"><img src="https://raw.githubusercontent.com/clap-rs/clap/master/assets/clap.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../clap/index.html"><img src="https://raw.githubusercontent.com/clap-rs/clap/master/assets/clap.png" alt="logo"></a><h2><a href="../../clap/index.html">clap</a><span class="version">4.5.13</span></h2></div><h2 class="location"><a href="#">Arg</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><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_aliases">get_aliases</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_value_terminator">get_value_terminator</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><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><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-for-Arg">PartialEq</a></li><li><a href="#impl-PartialOrd-for-Arg">PartialOrd</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-Arg">!RefUnwindSafe</a></li><li><a href="#impl-UnwindSafe-for-Arg">!UnwindSafe</a></li><li><a href="#impl-Freeze-for-Arg">Freeze</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></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-From%3CT%3E-for-T">From&lt;T&gt;</a></li><li><a href="#impl-Into%3CU%3E-for-T">Into&lt;U&gt;</a></li><li><a href="#impl-ToOwned-for-T">ToOwned</a></li><li><a href="#impl-ToString-for-T">ToString</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto&lt;U&gt;</a></li></ul></section><h2><a href="index.html">In clap::builder</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Struct <a href="../index.html">clap</a>::<wbr><a href="index.html">builder</a>::<wbr><a class="struct" href="#">Arg</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../../src/clap_builder/builder/arg.rs.html#57">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub struct Arg { <span class="comment">/* private fields */</span> }</code></pre><details class="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="../struct.Arg.html" title="struct clap::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="../struct.Arg.html#basic-api" title="struct clap::Arg">Basic API</a></li>
<li><a href="../struct.Arg.html#value-handling" title="struct clap::Arg">Value Handling</a></li>
<li><a href="../struct.Arg.html#help-1" title="struct clap::Arg">Help</a></li>
<li><a href="../struct.Arg.html#advanced-argument-relations" title="struct clap::Arg">Advanced Argument Relations</a></li>
<li><a href="../struct.Arg.html#reflection" title="struct clap::Arg">Reflection</a></li>
</ul>
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</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>cfg = Arg::new(<span class="string">"config"</span>)
.short(<span class="string">'c'</span>)
.long(<span class="string">"config"</span>)
.action(ArgAction::Set)
.value_name(<span class="string">"FILE"</span>)
.help(<span class="string">"Provides a config file to myprog"</span>);
<span class="comment">// Using a usage string (setting a similar argument to the one above)
</span><span class="kw">let </span>input = <span class="macro">arg!</span>(-i --input &lt;FILE&gt; <span class="string">"Provides an input file to the program"</span>);</code></pre></div>
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Arg" class="impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#92">source</a><a href="#impl-Arg" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h3></section></summary><div class="docblock"><h4 id="basic-api"><a class="doc-anchor" href="#basic-api">§</a>Basic API</h4></div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#111">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>(id: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Create a new <a href="../struct.Arg.html" title="struct clap::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="../struct.Arg.html#method.action" title="method clap::Arg::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 class="doc-anchor" href="#examples-1">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"config"</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.id" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#119">source</a><h4 class="code-header">pub fn <a href="#method.id" class="fn">id</a>(self, id: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Set the identifier used for referencing this argument in the clap API.</p>
<p>See <a href="../struct.Arg.html#method.new" title="associated function clap::Arg::new"><code>Arg::new</code></a> for more details.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.short" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#171">source</a><h4 class="code-header">pub fn <a href="#method.short" class="fn">short</a>(self, s: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.char.html">char</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.Command.html#method.disable_help_flag" title="method clap::Command::disable_help_flag"><code>disable_help_flag</code></a>,
<a href="../struct.Command.html#method.disable_version_flag" title="method clap::Command::disable_version_flag"><code>disable_version_flag</code></a>) and define your own.</p>
<h5 id="examples-2"><a class="doc-anchor" href="#examples-2">§</a>Examples</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"config"</span>)
.short(<span class="string">'c'</span>)
.action(ArgAction::Set))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"-c"</span>, <span class="string">"file.toml"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"config"</span>).map(String::as_str), <span class="prelude-val">Some</span>(<span class="string">"file.toml"</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>m = Command::new(<span class="string">"prog"</span>)
.disable_help_flag(<span class="bool-val">true</span>)
.arg(Arg::new(<span class="string">"host"</span>)
.short(<span class="string">'h'</span>)
.long(<span class="string">"host"</span>))
.arg(Arg::new(<span class="string">"help"</span>)
.long(<span class="string">"help"</span>)
.global(<span class="bool-val">true</span>)
.action(ArgAction::Help))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"-h"</span>, <span class="string">"wikipedia.org"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"host"</span>).map(String::as_str), <span class="prelude-val">Some</span>(<span class="string">"wikipedia.org"</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.long" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#213">source</a><h4 class="code-header">pub fn <a href="#method.long" class="fn">long</a>(self, l: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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 class="doc-anchor" href="#examples-3">§</a>Examples</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.long(<span class="string">"config"</span>)
.action(ArgAction::Set))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--config"</span>, <span class="string">"file.toml"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"cfg"</span>).map(String::as_str), <span class="prelude-val">Some</span>(<span class="string">"file.toml"</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.alias" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#239">source</a><h4 class="code-header">pub fn <a href="#method.alias" class="fn">alias</a>(self, name: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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 class="doc-anchor" href="#examples-4">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"test"</span>)
.long(<span class="string">"test"</span>)
.alias(<span class="string">"alias"</span>)
.action(ArgAction::Set))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--alias"</span>, <span class="string">"cool"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"test"</span>).unwrap(), <span class="string">"cool"</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.short_alias" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#269">source</a><h4 class="code-header">pub fn <a href="#method.short_alias" class="fn">short_alias</a>(self, name: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.char.html">char</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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 class="doc-anchor" href="#examples-5">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"test"</span>)
.short(<span class="string">'t'</span>)
.short_alias(<span class="string">'e'</span>)
.action(ArgAction::Set))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"-e"</span>, <span class="string">"cool"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"test"</span>).unwrap(), <span class="string">"cool"</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.aliases" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#302">source</a><h4 class="code-header">pub fn <a href="#method.aliases" class="fn">aliases</a>(self, names: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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 class="doc-anchor" href="#examples-6">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"test"</span>)
.long(<span class="string">"test"</span>)
.aliases([<span class="string">"do-stuff"</span>, <span class="string">"do-tests"</span>, <span class="string">"tests"</span>])
.action(ArgAction::SetTrue)
.help(<span class="string">"the file to add"</span>)
.required(<span class="bool-val">false</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--do-tests"
</span>]);
<span class="macro">assert_eq!</span>(m.get_flag(<span class="string">"test"</span>), <span class="bool-val">true</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.short_aliases" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#331">source</a><h4 class="code-header">pub fn <a href="#method.short_aliases" class="fn">short_aliases</a>(self, names: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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.80.0/std/primitive.char.html">char</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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 class="doc-anchor" href="#examples-7">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"test"</span>)
.short(<span class="string">'t'</span>)
.short_aliases([<span class="string">'e'</span>, <span class="string">'s'</span>])
.action(ArgAction::SetTrue)
.help(<span class="string">"the file to add"</span>)
.required(<span class="bool-val">false</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"-s"
</span>]);
<span class="macro">assert_eq!</span>(m.get_flag(<span class="string">"test"</span>), <span class="bool-val">true</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.visible_alias" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#360">source</a><h4 class="code-header">pub fn <a href="#method.visible_alias" class="fn">visible_alias</a>(self, name: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Add an alias, which functions as a visible long flag.</p>
<p>Like <a href="../struct.Arg.html#method.alias" title="method clap::Arg::alias"><code>Arg::alias</code></a>, except that they are visible inside the help message.</p>
<h5 id="examples-8"><a class="doc-anchor" href="#examples-8">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"test"</span>)
.visible_alias(<span class="string">"something-awesome"</span>)
.long(<span class="string">"test"</span>)
.action(ArgAction::Set))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--something-awesome"</span>, <span class="string">"coffee"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"test"</span>).unwrap(), <span class="string">"coffee"</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.visible_short_alias" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#389">source</a><h4 class="code-header">pub fn <a href="#method.visible_short_alias" class="fn">visible_short_alias</a>(self, name: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.char.html">char</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Add an alias, which functions as a visible short flag.</p>
<p>Like <a href="../struct.Arg.html#method.short_alias" title="method clap::Arg::short_alias"><code>Arg::short_alias</code></a>, except that they are visible inside the help message.</p>
<h5 id="examples-9"><a class="doc-anchor" href="#examples-9">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"test"</span>)
.long(<span class="string">"test"</span>)
.visible_short_alias(<span class="string">'t'</span>)
.action(ArgAction::Set))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"-t"</span>, <span class="string">"coffee"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"test"</span>).unwrap(), <span class="string">"coffee"</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.visible_aliases" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#420">source</a><h4 class="code-header">pub fn <a href="#method.visible_aliases" class="fn">visible_aliases</a>(
self,
names: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;&gt;,
) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Add aliases, which function as visible long flags.</p>
<p>Like <a href="../struct.Arg.html#method.aliases" title="method clap::Arg::aliases"><code>Arg::aliases</code></a>, except that they are visible inside the help message.</p>
<h5 id="examples-10"><a class="doc-anchor" href="#examples-10">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"test"</span>)
.long(<span class="string">"test"</span>)
.action(ArgAction::SetTrue)
.visible_aliases([<span class="string">"something"</span>, <span class="string">"awesome"</span>, <span class="string">"cool"</span>]))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--awesome"
</span>]);
<span class="macro">assert_eq!</span>(m.get_flag(<span class="string">"test"</span>), <span class="bool-val">true</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.visible_short_aliases" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#446">source</a><h4 class="code-header">pub fn <a href="#method.visible_short_aliases" class="fn">visible_short_aliases</a>(self, names: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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.80.0/std/primitive.char.html">char</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Add aliases, which function as visible short flags.</p>
<p>Like <a href="../struct.Arg.html#method.short_aliases" title="method clap::Arg::short_aliases"><code>Arg::short_aliases</code></a>, except that they are visible inside the help message.</p>
<h5 id="examples-11"><a class="doc-anchor" href="#examples-11">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"test"</span>)
.long(<span class="string">"test"</span>)
.action(ArgAction::SetTrue)
.visible_short_aliases([<span class="string">'t'</span>, <span class="string">'e'</span>]))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"-t"
</span>]);
<span class="macro">assert_eq!</span>(m.get_flag(<span class="string">"test"</span>), <span class="bool-val">true</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.index" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#508">source</a><h4 class="code-header">pub fn <a href="#method.index" class="fn">index</a>(self, idx: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.Arg.html#method.short" title="method clap::Arg::short"><code>Arg::short</code></a> or <a href="../struct.Arg.html#method.long" title="method clap::Arg::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 class="doc-anchor" href="#panics">§</a>Panics</h5>
<p><a href="../struct.Command.html" title="struct clap::Command"><code>Command</code></a> will <a href="https://doc.rust-lang.org/1.80.0/std/macro.panic.html" title="macro std::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 (debug builds)</p>
<h5 id="examples-12"><a class="doc-anchor" href="#examples-12">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"config"</span>)
.index(<span class="number">1</span>)</code></pre></div>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"mode"</span>)
.index(<span class="number">1</span>))
.arg(Arg::new(<span class="string">"debug"</span>)
.long(<span class="string">"debug"</span>)
.action(ArgAction::SetTrue))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--debug"</span>, <span class="string">"fast"
</span>]);
<span class="macro">assert!</span>(m.contains_id(<span class="string">"mode"</span>));
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"mode"</span>).unwrap(), <span class="string">"fast"</span>); <span class="comment">// notice index(1) means "first positional"
// *not* first argument</span></code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.trailing_var_arg" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#537">source</a><h4 class="code-header">pub fn <a href="#method.trailing_var_arg" class="fn">trailing_var_arg</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>This is a “var arg” 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 “var arg” on unknown flags (and not just a positional
value), set <a href="../struct.Arg.html#method.allow_hyphen_values" title="method clap::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="../struct.Arg.html#method.value_delimiter" title="method clap::Arg::value_delimiter"><code>Arg::value_delimiter</code></a> still applies if set.</p>
<p><strong>NOTE:</strong> Setting this requires <a href="../struct.Arg.html#method.num_args" title="method clap::Arg::num_args"><code>Arg::num_args(..)</code></a>.</p>
<h5 id="examples-13"><a class="doc-anchor" href="#examples-13">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.arg(<span class="macro">arg!</span>(&lt;cmd&gt; ... <span class="string">"commands to run"</span>).trailing_var_arg(<span class="bool-val">true</span>))
.get_matches_from(<span class="macro">vec!</span>[<span class="string">"myprog"</span>, <span class="string">"arg1"</span>, <span class="string">"-r"</span>, <span class="string">"val1"</span>]);
<span class="kw">let </span>trail: Vec&lt;<span class="kw">_</span>&gt; = m.get_many::&lt;String&gt;(<span class="string">"cmd"</span>).unwrap().collect();
<span class="macro">assert_eq!</span>(trail, [<span class="string">"arg1"</span>, <span class="string">"-r"</span>, <span class="string">"val1"</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.last" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#626">source</a><h4 class="code-header">pub fn <a href="#method.last" class="fn">last</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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" title="variant clap::error::ErrorKind::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="../struct.Command.html#method.dont_collapse_args_in_usage" title="method clap::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="../struct.Arg.html#method.num_args" title="method clap::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="../struct.Command.html#method.args_conflicts_with_subcommands" title="method clap::Command::args_conflicts_with_subcommands"><code>crate::Command::args_conflicts_with_subcommands</code></a>
(or <a href="../struct.Command.html#method.subcommand_negates_reqs" title="method clap::Command::subcommand_negates_reqs"><code>crate::Command::subcommand_negates_reqs</code></a> if the argument marked <code>Last</code> is also
marked <a href="../struct.Arg.html#method.required" title="method clap::Arg::required"><code>Arg::required</code></a>)</p>
<h5 id="examples-14"><a class="doc-anchor" href="#examples-14">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"args"</span>)
.action(ArgAction::Set)
.last(<span class="bool-val">true</span>)</code></pre></div>
<p>Setting <code>last</code> ensures the arg has the highest <a href="../struct.Arg.html#method.index" title="method clap::Arg::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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"first"</span>))
.arg(Arg::new(<span class="string">"second"</span>))
.arg(Arg::new(<span class="string">"third"</span>)
.action(ArgAction::Set)
.last(<span class="bool-val">true</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"one"</span>, <span class="string">"--"</span>, <span class="string">"three"
</span>]);
<span class="macro">assert!</span>(res.is_ok());
<span class="kw">let </span>m = res.unwrap();
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"third"</span>).unwrap(), <span class="string">"three"</span>);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"second"</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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"first"</span>))
.arg(Arg::new(<span class="string">"second"</span>))
.arg(Arg::new(<span class="string">"third"</span>)
.action(ArgAction::Set)
.last(<span class="bool-val">true</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"one"</span>, <span class="string">"two"</span>, <span class="string">"three"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::UnknownArgument);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.required" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#692">source</a><h4 class="code-header">pub fn <a href="#method.required" class="fn">required</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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 class="doc-anchor" href="#examples-15">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"config"</span>)
.required(<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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.required(<span class="bool-val">true</span>)
.action(ArgAction::Set)
.long(<span class="string">"config"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--config"</span>, <span class="string">"file.conf"</span>,
]);
<span class="macro">assert!</span>(res.is_ok());</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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.required(<span class="bool-val">true</span>)
.action(ArgAction::Set)
.long(<span class="string">"config"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::MissingRequiredArgument);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.requires" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#758">source</a><h4 class="code-header">pub fn <a href="#method.requires" class="fn">requires</a>(self, arg_id: impl <a class="trait" href="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; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.Arg.html#method.conflicts_with" title="method clap::Arg::conflicts_with">Conflicting</a> rules and <a href="../struct.Arg.html#method.overrides_with" title="method clap::Arg::overrides_with">override</a> rules take precedence over being required</p>
<h5 id="examples-16"><a class="doc-anchor" href="#examples-16">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"config"</span>)
.requires(<span class="string">"input"</span>)</code></pre></div>
<p>Setting <a href="../struct.Arg.html#method.requires" title="method clap::Arg::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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.action(ArgAction::Set)
.requires(<span class="string">"input"</span>)
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"input"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"
</span>]);
<span class="macro">assert!</span>(res.is_ok()); <span class="comment">// We didn't use cfg, so input wasn't required</span></code></pre></div>
<p>Setting <a href="../struct.Arg.html#method.requires" title="method clap::Arg::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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.action(ArgAction::Set)
.requires(<span class="string">"input"</span>)
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"input"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--config"</span>, <span class="string">"file.conf"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::MissingRequiredArgument);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.exclusive" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#802">source</a><h4 class="code-header">pub fn <a href="#method.exclusive" class="fn">exclusive</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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 class="doc-anchor" href="#examples-17">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"config"</span>)
.exclusive(<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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"exclusive"</span>)
.action(ArgAction::Set)
.exclusive(<span class="bool-val">true</span>)
.long(<span class="string">"exclusive"</span>))
.arg(Arg::new(<span class="string">"debug"</span>)
.long(<span class="string">"debug"</span>))
.arg(Arg::new(<span class="string">"input"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--exclusive"</span>, <span class="string">"file.conf"</span>, <span class="string">"file.txt"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::ArgumentConflict);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.global" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#846">source</a><h4 class="code-header">pub fn <a href="#method.global" class="fn">global</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Specifies that an argument can be matched to all child <a href="../trait.Subcommand.html" title="trait clap::Subcommand"><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 class="doc-anchor" href="#examples-18">§</a>Examples</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="../struct.Arg.html" title="struct clap::Arg"><code>Arg</code></a> definitions.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"verb"</span>)
.long(<span class="string">"verbose"</span>)
.short(<span class="string">'v'</span>)
.action(ArgAction::SetTrue)
.global(<span class="bool-val">true</span>))
.subcommand(Command::new(<span class="string">"test"</span>))
.subcommand(Command::new(<span class="string">"do-stuff"</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"do-stuff"</span>, <span class="string">"--verbose"
</span>]);
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">"do-stuff"</span>));
<span class="kw">let </span>sub_m = m.subcommand_matches(<span class="string">"do-stuff"</span>).unwrap();
<span class="macro">assert_eq!</span>(sub_m.get_flag(<span class="string">"verb"</span>), <span class="bool-val">true</span>);</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Arg-1" class="impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#875">source</a><a href="#impl-Arg-1" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h3></section></summary><div class="docblock"><h4 id="value-handling"><a class="doc-anchor" href="#value-handling">§</a>Value Handling</h4></div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.action" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#907">source</a><h4 class="code-header">pub fn <a href="#method.action" class="fn">action</a>(self, action: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="enum" href="../enum.ArgAction.html" title="enum clap::ArgAction">ArgAction</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Specify how to react to an argument when parsing it.</p>
<p><a href="../enum.ArgAction.html" title="enum clap::ArgAction"><code>ArgAction</code></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 class="doc-anchor" href="#examples-19">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>cmd = Command::new(<span class="string">"mycmd"</span>)
.arg(
Arg::new(<span class="string">"flag"</span>)
.long(<span class="string">"flag"</span>)
.action(clap::ArgAction::Append)
);
<span class="kw">let </span>matches = cmd.try_get_matches_from([<span class="string">"mycmd"</span>, <span class="string">"--flag"</span>, <span class="string">"value"</span>]).unwrap();
<span class="macro">assert!</span>(matches.contains_id(<span class="string">"flag"</span>));
<span class="macro">assert_eq!</span>(
matches.get_many::&lt;String&gt;(<span class="string">"flag"</span>).unwrap_or_default().map(|v| v.as_str()).collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;(),
<span class="macro">vec!</span>[<span class="string">"value"</span>]
);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.value_parser" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#969">source</a><h4 class="code-header">pub fn <a href="#method.value_parser" class="fn">value_parser</a>(self, parser: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.ValueParser.html" title="struct clap::builder::ValueParser">ValueParser</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.ArgMatches.html" title="struct clap::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="macro clap::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.80.0/core/ops/range/trait.RangeBounds.html" title="trait core::ops::range::RangeBounds">range expressions like <code>0..=1</code></a> as a shorthand for <a href="struct.RangedI64ValueParser.html" title="struct clap::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="struct.PossibleValuesParser.html" title="struct clap::builder::PossibleValuesParser"><code>PossibleValuesParser</code></a> for static enumerated values</li>
<li><a href="struct.BoolishValueParser.html" title="struct clap::builder::BoolishValueParser"><code>BoolishValueParser</code></a>, and <a href="struct.FalseyValueParser.html" title="struct clap::builder::FalseyValueParser"><code>FalseyValueParser</code></a> for alternative <code>bool</code> implementations</li>
<li><a href="struct.NonEmptyStringValueParser.html" title="struct clap::builder::NonEmptyStringValueParser"><code>NonEmptyStringValueParser</code></a> for basic validation for strings</li>
<li>or any other <a href="trait.TypedValueParser.html" title="trait clap::builder::TypedValueParser"><code>TypedValueParser</code></a> implementation</li>
</ul>
<p>The default value is <a href="struct.ValueParser.html#method.string" title="associated function clap::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>cmd = clap::Command::new(<span class="string">"raw"</span>)
.arg(
clap::Arg::new(<span class="string">"color"</span>)
.long(<span class="string">"color"</span>)
.value_parser([<span class="string">"always"</span>, <span class="string">"auto"</span>, <span class="string">"never"</span>])
.default_value(<span class="string">"auto"</span>)
)
.arg(
clap::Arg::new(<span class="string">"hostname"</span>)
.long(<span class="string">"hostname"</span>)
.value_parser(clap::builder::NonEmptyStringValueParser::new())
.action(ArgAction::Set)
.required(<span class="bool-val">true</span>)
)
.arg(
clap::Arg::new(<span class="string">"port"</span>)
.long(<span class="string">"port"</span>)
.value_parser(<span class="macro">clap::value_parser!</span>(u16).range(<span class="number">3000</span>..))
.action(ArgAction::Set)
.required(<span class="bool-val">true</span>)
);
<span class="kw">let </span>m = cmd.try_get_matches_from_mut(
[<span class="string">"cmd"</span>, <span class="string">"--hostname"</span>, <span class="string">"rust-lang.org"</span>, <span class="string">"--port"</span>, <span class="string">"3001"</span>]
).unwrap();
<span class="kw">let </span>color: <span class="kw-2">&amp;</span>String = m.get_one(<span class="string">"color"</span>)
.expect(<span class="string">"default"</span>);
<span class="macro">assert_eq!</span>(color, <span class="string">"auto"</span>);
<span class="kw">let </span>hostname: <span class="kw-2">&amp;</span>String = m.get_one(<span class="string">"hostname"</span>)
.expect(<span class="string">"required"</span>);
<span class="macro">assert_eq!</span>(hostname, <span class="string">"rust-lang.org"</span>);
<span class="kw">let </span>port: u16 = <span class="kw-2">*</span>m.get_one(<span class="string">"port"</span>)
.expect(<span class="string">"required"</span>);
<span class="macro">assert_eq!</span>(port, <span class="number">3001</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.num_args" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#1126">source</a><h4 class="code-header">pub fn <a href="#method.num_args" class="fn">num_args</a>(self, qty: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.ValueRange.html" title="struct clap::builder::ValueRange">ValueRange</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.Arg.html#method.value_terminator" title="method clap::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="../struct.Arg.html#method.value_delimiter" title="method clap::Arg::value_delimiter"><code>Arg::value_delimiter</code></a></li>
<li>Require a flag occurrence per value with <a href="../enum.ArgAction.html#variant.Append" title="variant clap::ArgAction::Append"><code>ArgAction::Append</code></a></li>
<li>Require positional arguments to appear after <code>--</code> with <a href="../struct.Arg.html#method.last" title="method clap::Arg::last"><code>Arg::last</code></a></li>
</ul>
<h5 id="examples-20"><a class="doc-anchor" href="#examples-20">§</a>Examples</h5>
<p>Option:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"mode"</span>)
.long(<span class="string">"mode"</span>)
.num_args(<span class="number">1</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--mode"</span>, <span class="string">"fast"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"mode"</span>).unwrap(), <span class="string">"fast"</span>);</code></pre></div>
<p>Flag/option hybrid (see also <a href="../struct.Arg.html#method.default_missing_value" title="method clap::Arg::default_missing_value"><code>default_missing_value</code></a>)</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>cmd = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"mode"</span>)
.long(<span class="string">"mode"</span>)
.default_missing_value(<span class="string">"slow"</span>)
.default_value(<span class="string">"plaid"</span>)
.num_args(<span class="number">0</span>..=<span class="number">1</span>));
<span class="kw">let </span>m = cmd.clone()
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--mode"</span>, <span class="string">"fast"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"mode"</span>).unwrap(), <span class="string">"fast"</span>);
<span class="kw">let </span>m = cmd.clone()
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--mode"</span>,
]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"mode"</span>).unwrap(), <span class="string">"slow"</span>);
<span class="kw">let </span>m = cmd.clone()
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>,
]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"mode"</span>).unwrap(), <span class="string">"plaid"</span>);</code></pre></div>
<p>Tuples</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>cmd = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"file"</span>)
.action(ArgAction::Set)
.num_args(<span class="number">2</span>)
.short(<span class="string">'F'</span>));
<span class="kw">let </span>m = cmd.clone()
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"-F"</span>, <span class="string">"in-file"</span>, <span class="string">"out-file"
</span>]);
<span class="macro">assert_eq!</span>(
m.get_many::&lt;String&gt;(<span class="string">"file"</span>).unwrap_or_default().map(|v| v.as_str()).collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;(),
<span class="macro">vec!</span>[<span class="string">"in-file"</span>, <span class="string">"out-file"</span>]
);
<span class="kw">let </span>res = cmd.clone()
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"-F"</span>, <span class="string">"file1"
</span>]);
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::WrongNumberOfValues);</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>cmd = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"file"</span>)
.action(ArgAction::Set)
.num_args(<span class="number">0</span>..)
.short(<span class="string">'F'</span>))
.arg(Arg::new(<span class="string">"word"</span>));
<span class="kw">let </span>m = cmd.clone().get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"-F"</span>, <span class="string">"file1"</span>, <span class="string">"file2"</span>, <span class="string">"file3"</span>, <span class="string">"word"
</span>]);
<span class="kw">let </span>files: Vec&lt;<span class="kw">_</span>&gt; = m.get_many::&lt;String&gt;(<span class="string">"file"</span>).unwrap().collect();
<span class="macro">assert_eq!</span>(files, [<span class="string">"file1"</span>, <span class="string">"file2"</span>, <span class="string">"file3"</span>, <span class="string">"word"</span>]); <span class="comment">// wait...what?!
</span><span class="macro">assert!</span>(!m.contains_id(<span class="string">"word"</span>)); <span class="comment">// but we clearly used word!
// but this works
</span><span class="kw">let </span>m = cmd.clone().get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"word"</span>, <span class="string">"-F"</span>, <span class="string">"file1"</span>, <span class="string">"file2"</span>, <span class="string">"file3"</span>,
]);
<span class="kw">let </span>files: Vec&lt;<span class="kw">_</span>&gt; = m.get_many::&lt;String&gt;(<span class="string">"file"</span>).unwrap().collect();
<span class="macro">assert_eq!</span>(files, [<span class="string">"file1"</span>, <span class="string">"file2"</span>, <span class="string">"file3"</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"word"</span>).unwrap(), <span class="string">"word"</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="../enum.ArgAction.html#variant.Append" title="variant clap::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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"file"</span>)
.action(ArgAction::Append)
.short(<span class="string">'F'</span>))
.arg(Arg::new(<span class="string">"word"</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"-F"</span>, <span class="string">"file1"</span>, <span class="string">"-F"</span>, <span class="string">"file2"</span>, <span class="string">"-F"</span>, <span class="string">"file3"</span>, <span class="string">"word"
</span>]);
<span class="kw">let </span>files: Vec&lt;<span class="kw">_</span>&gt; = m.get_many::&lt;String&gt;(<span class="string">"file"</span>).unwrap().collect();
<span class="macro">assert_eq!</span>(files, [<span class="string">"file1"</span>, <span class="string">"file2"</span>, <span class="string">"file3"</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"word"</span>).unwrap(), <span class="string">"word"</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.value_name" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#1190">source</a><h4 class="code-header">pub fn <a href="#method.value_name" class="fn">value_name</a>(self, name: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.Arg.html#method.action" title="method clap::Arg::action"><code>Arg::action(ArgAction::Set)</code></a></p>
<h5 id="examples-21"><a class="doc-anchor" href="#examples-21">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"cfg"</span>)
.long(<span class="string">"config"</span>)
.value_name(<span class="string">"FILE"</span>)</code></pre></div>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"config"</span>)
.long(<span class="string">"config"</span>)
.value_name(<span class="string">"FILE"</span>)
.help(<span class="string">"Some help text"</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--help"
</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="toggle method-toggle" open><summary><section id="method.value_names" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#1256">source</a><h4 class="code-header">pub fn <a href="#method.value_names" class="fn">value_names</a>(self, names: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.Arg.html#method.next_line_help" title="method clap::Arg::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="../struct.Arg.html#method.action" title="method clap::Arg::action"><code>Arg::action(ArgAction::Set)</code></a> and <a href="../struct.Arg.html#method.num_args" title="method clap::Arg::num_args"><code>Arg::num_args(1..)</code></a>.</p>
<h5 id="examples-22"><a class="doc-anchor" href="#examples-22">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"speed"</span>)
.short(<span class="string">'s'</span>)
.value_names([<span class="string">"fast"</span>, <span class="string">"slow"</span>]);</code></pre></div>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"io"</span>)
.long(<span class="string">"io-files"</span>)
.value_names([<span class="string">"INFILE"</span>, <span class="string">"OUTFILE"</span>]))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--help"
</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="toggle method-toggle" open><summary><section id="method.value_hint" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#1293">source</a><h4 class="code-header">pub fn <a href="#method.value_hint" class="fn">value_hint</a>(self, value_hint: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="enum" href="../enum.ValueHint.html" title="enum clap::ValueHint">ValueHint</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Provide the shell a hint about how to complete this argument.</p>
<p>See <a href="../enum.ValueHint.html" title="enum clap::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>Arg::new(<span class="string">"user"</span>)
.short(<span class="string">'u'</span>)
.long(<span class="string">"user"</span>)
.value_hint(ValueHint::Username);</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>Command::new(<span class="string">"prog"</span>)
.trailing_var_arg(<span class="bool-val">true</span>)
.arg(
Arg::new(<span class="string">"command"</span>)
.action(ArgAction::Set)
.num_args(<span class="number">1</span>..)
.value_hint(ValueHint::CommandWithArguments)
);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.ignore_case" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#1350">source</a><h4 class="code-header">pub fn <a href="#method.ignore_case" class="fn">ignore_case</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Match values against <a href="struct.PossibleValuesParser.html" title="struct clap::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="../struct.Arg.html#method.required_if_eq" title="method clap::Arg::required_if_eq"><code>Arg::required_if_eq</code></a>, <a href="../struct.Arg.html#method.required_if_eq_any" title="method clap::Arg::required_if_eq_any"><code>Arg::required_if_eq_any</code></a>, or
<a href="../struct.Arg.html#method.required_if_eq_all" title="method clap::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="../struct.Arg.html#method.num_args" title="method clap::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 class="doc-anchor" href="#examples-23">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"pv"</span>)
.arg(Arg::new(<span class="string">"option"</span>)
.long(<span class="string">"option"</span>)
.action(ArgAction::Set)
.ignore_case(<span class="bool-val">true</span>)
.value_parser([<span class="string">"test123"</span>]))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"pv"</span>, <span class="string">"--option"</span>, <span class="string">"TeSt123"</span>,
]);
<span class="macro">assert!</span>(m.get_one::&lt;String&gt;(<span class="string">"option"</span>).unwrap().eq_ignore_ascii_case(<span class="string">"test123"</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>m = Command::new(<span class="string">"pv"</span>)
.arg(Arg::new(<span class="string">"option"</span>)
.short(<span class="string">'o'</span>)
.long(<span class="string">"option"</span>)
.action(ArgAction::Set)
.ignore_case(<span class="bool-val">true</span>)
.num_args(<span class="number">1</span>..)
.value_parser([<span class="string">"test123"</span>, <span class="string">"test321"</span>]))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"pv"</span>, <span class="string">"--option"</span>, <span class="string">"TeSt123"</span>, <span class="string">"teST123"</span>, <span class="string">"tESt321"
</span>]);
<span class="kw">let </span>matched_vals = m.get_many::&lt;String&gt;(<span class="string">"option"</span>).unwrap().collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;*</span>matched_vals, <span class="kw-2">&amp;</span>[<span class="string">"TeSt123"</span>, <span class="string">"teST123"</span>, <span class="string">"tESt321"</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.allow_hyphen_values" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#1414">source</a><h4 class="code-header">pub fn <a href="#method.allow_hyphen_values" class="fn">allow_hyphen_values</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.Arg.html#method.allow_negative_numbers" title="method clap::Arg::allow_negative_numbers"><code>allow_negative_numbers</code></a>.</p>
<p>See also <a href="../struct.Arg.html#method.trailing_var_arg" title="method clap::Arg::trailing_var_arg"><code>trailing_var_arg</code></a>.</p>
<p><strong>NOTE:</strong> Setting this requires <a href="../struct.Arg.html#method.num_args" title="method clap::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="../struct.Arg.html#method.value_terminator" title="method clap::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="../struct.Arg.html#method.num_args" title="method clap::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 class="doc-anchor" href="#examples-24">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"pat"</span>)
.action(ArgAction::Set)
.allow_hyphen_values(<span class="bool-val">true</span>)
.long(<span class="string">"pattern"</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--pattern"</span>, <span class="string">"-file"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"pat"</span>).unwrap(), <span class="string">"-file"</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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"pat"</span>)
.action(ArgAction::Set)
.long(<span class="string">"pattern"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--pattern"</span>, <span class="string">"-file"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::UnknownArgument);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.allow_negative_numbers" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#1444">source</a><h4 class="code-header">pub fn <a href="#method.allow_negative_numbers" class="fn">allow_negative_numbers</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Allows negative numbers to pass as values.</p>
<p>This is similar to <a href="../struct.Arg.html#method.allow_hyphen_values" title="method clap::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="../struct.Arg.html#method.num_args" title="method clap::Arg::num_args">taking values</a></p>
<h5 id="examples-25"><a class="doc-anchor" href="#examples-25">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>res = Command::new(<span class="string">"myprog"</span>)
.arg(Arg::new(<span class="string">"num"</span>).allow_negative_numbers(<span class="bool-val">true</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"myprog"</span>, <span class="string">"-20"
</span>]);
<span class="macro">assert!</span>(res.is_ok());
<span class="kw">let </span>m = res.unwrap();
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"num"</span>).unwrap(), <span class="string">"-20"</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.require_equals" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#1498">source</a><h4 class="code-header">pub fn <a href="#method.require_equals" class="fn">require_equals</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.Arg.html#method.num_args" title="method clap::Arg::num_args">taking values</a></p>
<h5 id="examples-26"><a class="doc-anchor" href="#examples-26">§</a>Examples</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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.action(ArgAction::Set)
.require_equals(<span class="bool-val">true</span>)
.long(<span class="string">"config"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--config=file.conf"
</span>]);
<span class="macro">assert!</span>(res.is_ok());</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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.action(ArgAction::Set)
.require_equals(<span class="bool-val">true</span>)
.long(<span class="string">"config"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--config"</span>, <span class="string">"file.conf"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::NoEquals);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.value_delimiter" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#1548">source</a><h4 class="code-header">pub fn <a href="#method.value_delimiter" class="fn">value_delimiter</a>(self, d: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.char.html">char</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.Arg.html#method.action" title="method clap::Arg::action"><code>Arg::action(ArgAction::Set)</code></a></p>
<h5 id="examples-27"><a class="doc-anchor" href="#examples-27">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"config"</span>)
.short(<span class="string">'c'</span>)
.long(<span class="string">"config"</span>)
.value_delimiter(<span class="string">','</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--config=val1,val2,val3"
</span>]);
<span class="macro">assert_eq!</span>(m.get_many::&lt;String&gt;(<span class="string">"config"</span>).unwrap().collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;(), [<span class="string">"val1"</span>, <span class="string">"val2"</span>, <span class="string">"val3"</span>])</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.value_terminator" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#1603">source</a><h4 class="code-header">pub fn <a href="#method.value_terminator" class="fn">value_terminator</a>(self, term: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.Arg.html#method.num_args" title="method clap::Arg::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="../struct.Arg.html#method.num_args" title="method clap::Arg::num_args"><code>num_args</code></a>).</p>
<p><strong>NOTE:</strong> This setting only applies to <a href="../struct.Arg.html#method.action" title="method clap::Arg::action">options</a> and <a href="../struct.Arg.html#method.index" title="method clap::Arg::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 class="doc-anchor" href="#examples-28">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"vals"</span>)
.action(ArgAction::Set)
.num_args(<span class="number">1</span>..)
.value_terminator(<span class="string">";"</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cmds"</span>)
.action(ArgAction::Set)
.num_args(<span class="number">1</span>..)
.allow_hyphen_values(<span class="bool-val">true</span>)
.value_terminator(<span class="string">";"</span>))
.arg(Arg::new(<span class="string">"location"</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"find"</span>, <span class="string">"-type"</span>, <span class="string">"f"</span>, <span class="string">"-name"</span>, <span class="string">"special"</span>, <span class="string">";"</span>, <span class="string">"/home/clap"
</span>]);
<span class="kw">let </span>cmds: Vec&lt;<span class="kw">_</span>&gt; = m.get_many::&lt;String&gt;(<span class="string">"cmds"</span>).unwrap().collect();
<span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>cmds, <span class="kw-2">&amp;</span>[<span class="string">"find"</span>, <span class="string">"-type"</span>, <span class="string">"f"</span>, <span class="string">"-name"</span>, <span class="string">"special"</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"location"</span>).unwrap(), <span class="string">"/home/clap"</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.raw" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#1632">source</a><h4 class="code-header">pub fn <a href="#method.raw" class="fn">raw</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.Arg.html#method.trailing_var_arg" title="method clap::Arg::trailing_var_arg"><code>Arg::trailing_var_arg</code></a>
may be more appropriate.</p>
<p><strong>NOTE:</strong> Implicitly sets <a href="../struct.Arg.html#method.action" title="method clap::Arg::action"><code>Arg::action(ArgAction::Set)</code></a> <a href="../struct.Arg.html#method.num_args" title="method clap::Arg::num_args"><code>Arg::num_args(1..)</code></a>,
<a href="../struct.Arg.html#method.allow_hyphen_values" title="method clap::Arg::allow_hyphen_values"><code>Arg::allow_hyphen_values(true)</code></a>, and <a href="../struct.Arg.html#method.last" title="method clap::Arg::last"><code>Arg::last(true)</code></a> when set to <code>true</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.default_value" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#1697">source</a><h4 class="code-header">pub fn <a href="#method.default_value" class="fn">default_value</a>(self, val: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.ArgMatches.html#method.contains_id" title="method clap::ArgMatches::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="../struct.ArgMatches.html#method.value_source" title="method clap::ArgMatches::value_source"><code>ArgMatches::value_source</code></a>.</p>
<p><strong>NOTE:</strong> This setting is perfectly compatible with <a href="../struct.Arg.html#method.default_value_if" title="method clap::Arg::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>Like with command-line values, this will be split by <a href="../struct.Arg.html#method.value_delimiter" title="method clap::Arg::value_delimiter"><code>Arg::value_delimiter</code></a>.</p>
<h5 id="examples-29"><a class="doc-anchor" href="#examples-29">§</a>Examples</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"opt"</span>)
.long(<span class="string">"myopt"</span>)
.default_value(<span class="string">"myval"</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"opt"</span>).unwrap(), <span class="string">"myval"</span>);
<span class="macro">assert!</span>(m.contains_id(<span class="string">"opt"</span>));
<span class="macro">assert_eq!</span>(m.value_source(<span class="string">"opt"</span>), <span class="prelude-val">Some</span>(ValueSource::DefaultValue));</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"opt"</span>)
.long(<span class="string">"myopt"</span>)
.default_value(<span class="string">"myval"</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--myopt=non_default"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"opt"</span>).unwrap(), <span class="string">"non_default"</span>);
<span class="macro">assert!</span>(m.contains_id(<span class="string">"opt"</span>));
<span class="macro">assert_eq!</span>(m.value_source(<span class="string">"opt"</span>), <span class="prelude-val">Some</span>(ValueSource::CommandLine));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.default_values" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#1724">source</a><h4 class="code-header">pub fn <a href="#method.default_values" class="fn">default_values</a>(
self,
vals: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;&gt;,
) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Value for the argument when not present.</p>
<p>See <a href="../struct.Arg.html#method.default_value" title="method clap::Arg::default_value"><code>Arg::default_value</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.default_missing_value" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#1835">source</a><h4 class="code-header">pub fn <a href="#method.default_missing_value" class="fn">default_missing_value</a>(self, val: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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 a 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="../struct.Arg.html#method.num_args" title="method clap::Arg::num_args"><code>.num_args(0..N)</code></a> and the
<a href="../struct.Arg.html#method.require_equals" title="method clap::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>
<p>Like with command-line values, this will be split by <a href="../struct.Arg.html#method.value_delimiter" title="method clap::Arg::value_delimiter"><code>Arg::value_delimiter</code></a>.</p>
<h5 id="examples-30"><a class="doc-anchor" href="#examples-30">§</a>Examples</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>cli() -&gt; Command {
Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"color"</span>).long(<span class="string">"color"</span>)
.value_name(<span class="string">"WHEN"</span>)
.value_parser([<span class="string">"always"</span>, <span class="string">"auto"</span>, <span class="string">"never"</span>])
.default_value(<span class="string">"auto"</span>)
.num_args(<span class="number">0</span>..=<span class="number">1</span>)
.require_equals(<span class="bool-val">true</span>)
.default_missing_value(<span class="string">"always"</span>)
.help(<span class="string">"Specify WHEN to colorize output."</span>)
)
}
<span class="comment">// first, we'll provide no arguments
</span><span class="kw">let </span>m = cli().get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"color"</span>).unwrap(), <span class="string">"auto"</span>);
<span class="macro">assert_eq!</span>(m.value_source(<span class="string">"color"</span>), <span class="prelude-val">Some</span>(ValueSource::DefaultValue));
<span class="comment">// next, we'll provide a runtime value to override the default (as usually done).
</span><span class="kw">let </span>m = cli().get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--color=never"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"color"</span>).unwrap(), <span class="string">"never"</span>);
<span class="macro">assert_eq!</span>(m.value_source(<span class="string">"color"</span>), <span class="prelude-val">Some</span>(ValueSource::CommandLine));
<span class="comment">// finally, we will use the shortcut and only provide the argument without a value.
</span><span class="kw">let </span>m = cli().get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--color"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"color"</span>).unwrap(), <span class="string">"always"</span>);
<span class="macro">assert_eq!</span>(m.value_source(<span class="string">"color"</span>), <span class="prelude-val">Some</span>(ValueSource::CommandLine));</code></pre></div>
<p>For bool literals:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>cli() -&gt; Command {
Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"create"</span>).long(<span class="string">"create"</span>)
.value_name(<span class="string">"BOOL"</span>)
.value_parser(<span class="macro">value_parser!</span>(bool))
.num_args(<span class="number">0</span>..=<span class="number">1</span>)
.require_equals(<span class="bool-val">true</span>)
.default_missing_value(<span class="string">"true"</span>)
)
}
<span class="comment">// first, we'll provide no arguments
</span><span class="kw">let </span>m = cli().get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;bool&gt;(<span class="string">"create"</span>).copied(), <span class="prelude-val">None</span>);
<span class="comment">// next, we'll provide a runtime value to override the default (as usually done).
</span><span class="kw">let </span>m = cli().get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--create=false"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;bool&gt;(<span class="string">"create"</span>).copied(), <span class="prelude-val">Some</span>(<span class="bool-val">false</span>));
<span class="macro">assert_eq!</span>(m.value_source(<span class="string">"create"</span>), <span class="prelude-val">Some</span>(ValueSource::CommandLine));
<span class="comment">// finally, we will use the shortcut and only provide the argument without a value.
</span><span class="kw">let </span>m = cli().get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--create"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;bool&gt;(<span class="string">"create"</span>).copied(), <span class="prelude-val">Some</span>(<span class="bool-val">true</span>));
<span class="macro">assert_eq!</span>(m.value_source(<span class="string">"create"</span>), <span class="prelude-val">Some</span>(ValueSource::CommandLine));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.default_missing_value_os" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#1852">source</a><h4 class="code-header">pub fn <a href="#method.default_missing_value_os" class="fn">default_missing_value_os</a>(self, val: impl <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.Arg.html#method.default_missing_value" title="method clap::Arg::default_missing_value"><code>Arg::default_missing_value</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.default_missing_values" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#1863">source</a><h4 class="code-header">pub fn <a href="#method.default_missing_values" class="fn">default_missing_values</a>(
self,
vals: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;&gt;,
) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.Arg.html#method.default_missing_value" title="method clap::Arg::default_missing_value"><code>Arg::default_missing_value</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.default_missing_values_os" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#1875-1878">source</a><h4 class="code-header">pub fn <a href="#method.default_missing_values_os" class="fn">default_missing_values_os</a>(
self,
vals: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;&gt;,
) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.Arg.html#method.default_missing_values" title="method clap::Arg::default_missing_values"><code>Arg::default_missing_values</code></a>.</p>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Arg-2" class="impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#2060">source</a><a href="#impl-Arg-2" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h3></section></summary><div class="docblock"><h4 id="help-1"><a class="doc-anchor" href="#help-1">§</a>Help</h4></div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.help" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#2107">source</a><h4 class="code-header">pub fn <a href="#method.help" class="fn">help</a>(self, h: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.Arg.html#method.long_help" title="method clap::Arg::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 class="doc-anchor" href="#examples-31">§</a>Examples</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.long(<span class="string">"config"</span>)
.help(<span class="string">"Some help text describing the --config arg"</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--help"
</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="toggle method-toggle" open><summary><section id="method.long_help" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#2171">source</a><h4 class="code-header">pub fn <a href="#method.long_help" class="fn">long_help</a>(self, h: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.Arg.html#method.help" title="method clap::Arg::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="../struct.Arg.html#method.help" title="method clap::Arg::help"><code>Arg::help</code></a> is used in completion script generation in order to be concise</p>
<h5 id="examples-32"><a class="doc-anchor" href="#examples-32">§</a>Examples</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.long(<span class="string">"config"</span>)
.long_help(
<span class="string">"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'm going on
and on, so I'll stop now."</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--help"
</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="toggle method-toggle" open><summary><section id="method.display_order" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#2238">source</a><h4 class="code-header">pub fn <a href="#method.display_order" class="fn">display_order</a>(self, ord: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.usize.html">usize</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Allows custom ordering of args within the help message.</p>
<p><code>Arg</code>s with a lower value will be displayed first in the help message.
Those with the same display order will be sorted.</p>
<p><code>Arg</code>s are automatically assigned a display order based on the order they are added to the
<a href="../struct.Command.html" title="struct clap::Command"><code>Command</code></a>.
Overriding this is helpful when the order arguments are added in isnt the same as the
display order, whether in one-off cases or to automatically sort arguments.</p>
<p>To change, see <a href="../struct.Command.html#method.next_display_order" title="method clap::Command::next_display_order"><code>Command::next_display_order</code></a>.</p>
<p><strong>NOTE:</strong> This setting is ignored for <a href="../struct.Arg.html#method.index" title="method clap::Arg::index">positional arguments</a> which are always displayed in
<a href="../struct.Arg.html#method.index" title="method clap::Arg::index">index</a> order.</p>
<h5 id="examples-33"><a class="doc-anchor" href="#examples-33">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"boat"</span>)
.short(<span class="string">'b'</span>)
.long(<span class="string">"boat"</span>)
.action(ArgAction::Set)
.display_order(<span class="number">0</span>) <span class="comment">// Sort
</span>.help(<span class="string">"Some help and text"</span>))
.arg(Arg::new(<span class="string">"airplane"</span>)
.short(<span class="string">'a'</span>)
.long(<span class="string">"airplane"</span>)
.action(ArgAction::Set)
.display_order(<span class="number">0</span>) <span class="comment">// Sort
</span>.help(<span class="string">"I should be first!"</span>))
.arg(Arg::new(<span class="string">"custom-help"</span>)
.short(<span class="string">'?'</span>)
.action(ArgAction::Help)
.display_order(<span class="number">100</span>) <span class="comment">// Don't sort
</span>.help(<span class="string">"Alt help"</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--help"
</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:
-a, --airplane &lt;airplane&gt; I should be first!
-b, --boat &lt;boar&gt; Some help and text
-h, --help Print help information
-? Alt help
</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.help_heading" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#2248">source</a><h4 class="code-header">pub fn <a href="#method.help_heading" class="fn">help_heading</a>(self, heading: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Override the <a href="../struct.Command.html#method.next_help_heading" title="method clap::Command::next_help_heading">current</a> help section.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.next_line_help" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#2300">source</a><h4 class="code-header">pub fn <a href="#method.next_line_help" class="fn">next_line_help</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Render the <a href="../struct.Arg.html#method.help" title="method clap::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="../struct.Command.html#method.next_line_help" title="method clap::Command::next_line_help"><code>crate::Command::next_line_help</code></a></p>
<h5 id="examples-34"><a class="doc-anchor" href="#examples-34">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"opt"</span>)
.long(<span class="string">"long-option-flag"</span>)
.short(<span class="string">'o'</span>)
.action(ArgAction::Set)
.next_line_help(<span class="bool-val">true</span>)
.value_names([<span class="string">"value1"</span>, <span class="string">"value2"</span>])
.help(<span class="string">"Some really long help and complex\n\
help that makes more sense to be\n\
on a line after the option"</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--help"
</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="toggle method-toggle" open><summary><section id="method.hide" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#2344">source</a><h4 class="code-header">pub fn <a href="#method.hide" class="fn">hide</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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 class="doc-anchor" href="#examples-35">§</a>Examples</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.long(<span class="string">"config"</span>)
.hide(<span class="bool-val">true</span>)
.help(<span class="string">"Some help text describing the --config arg"</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--help"
</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="toggle method-toggle" open><summary><section id="method.hide_possible_values" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#2378">source</a><h4 class="code-header">pub fn <a href="#method.hide_possible_values" class="fn">hide_possible_values</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Do not display the <a href="struct.ValueParser.html#method.possible_values" title="method clap::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="../struct.Arg.html#method.num_args" title="method clap::Arg::num_args">taking values</a></p>
<p>To set this for all arguments, see
<a href="../struct.Command.html#method.hide_possible_values" title="method clap::Command::hide_possible_values"><code>Command::hide_possible_values</code></a>.</p>
<h5 id="examples-36"><a class="doc-anchor" href="#examples-36">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"mode"</span>)
.long(<span class="string">"mode"</span>)
.value_parser([<span class="string">"fast"</span>, <span class="string">"slow"</span>])
.action(ArgAction::Set)
.hide_possible_values(<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="toggle method-toggle" open><summary><section id="method.hide_default_value" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#2410">source</a><h4 class="code-header">pub fn <a href="#method.hide_default_value" class="fn">hide_default_value</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.Arg.html#method.num_args" title="method clap::Arg::num_args">taking values</a></p>
<h5 id="examples-37"><a class="doc-anchor" href="#examples-37">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"connect"</span>)
.arg(Arg::new(<span class="string">"host"</span>)
.long(<span class="string">"host"</span>)
.default_value(<span class="string">"localhost"</span>)
.action(ArgAction::Set)
.hide_default_value(<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="toggle method-toggle" open><summary><section id="method.hide_short_help" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#2555">source</a><h4 class="code-header">pub fn <a href="#method.hide_short_help" class="fn">hide_short_help</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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 class="doc-anchor" href="#examples-38">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"debug"</span>)
.hide_short_help(<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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.long(<span class="string">"config"</span>)
.hide_short_help(<span class="bool-val">true</span>)
.help(<span class="string">"Some help text describing the --config arg"</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"-h"
</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.long(<span class="string">"config"</span>)
.hide_short_help(<span class="bool-val">true</span>)
.help(<span class="string">"Some help text describing the --config arg"</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--help"
</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="toggle method-toggle" open><summary><section id="method.hide_long_help" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#2632">source</a><h4 class="code-header">pub fn <a href="#method.hide_long_help" class="fn">hide_long_help</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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 class="doc-anchor" href="#examples-39">§</a>Examples</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.long(<span class="string">"config"</span>)
.hide_long_help(<span class="bool-val">true</span>)
.help(<span class="string">"Some help text describing the --config arg"</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--help"
</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.long(<span class="string">"config"</span>)
.hide_long_help(<span class="bool-val">true</span>)
.help(<span class="string">"Some help text describing the --config arg"</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"-h"
</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="toggle implementors-toggle" open><summary><section id="impl-Arg-3" class="impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#2642">source</a><a href="#impl-Arg-3" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h3></section></summary><div class="docblock"><h4 id="advanced-argument-relations"><a class="doc-anchor" href="#advanced-argument-relations">§</a>Advanced Argument Relations</h4></div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.group" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#2680">source</a><h4 class="code-header">pub fn <a href="#method.group" class="fn">group</a>(self, group_id: impl <a class="trait" href="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; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>The name of the <a href="../struct.ArgGroup.html" title="struct clap::ArgGroup"><code>ArgGroup</code></a> the argument belongs to.</p>
<h5 id="examples-40"><a class="doc-anchor" href="#examples-40">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"debug"</span>)
.long(<span class="string">"debug"</span>)
.action(ArgAction::SetTrue)
.group(<span class="string">"mode"</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"debug"</span>)
.long(<span class="string">"debug"</span>)
.action(ArgAction::SetTrue)
.group(<span class="string">"mode"</span>))
.arg(Arg::new(<span class="string">"verbose"</span>)
.long(<span class="string">"verbose"</span>)
.action(ArgAction::SetTrue)
.group(<span class="string">"mode"</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--debug"
</span>]);
<span class="macro">assert!</span>(m.contains_id(<span class="string">"mode"</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.groups" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#2727">source</a><h4 class="code-header">pub fn <a href="#method.groups" class="fn">groups</a>(self, group_ids: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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.80.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; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>The names of <a href="../struct.ArgGroup.html" title="struct clap::ArgGroup"><code>ArgGroup</code></a>s the argument belongs to.</p>
<h5 id="examples-41"><a class="doc-anchor" href="#examples-41">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"debug"</span>)
.long(<span class="string">"debug"</span>)
.action(ArgAction::SetTrue)
.groups([<span class="string">"mode"</span>, <span class="string">"verbosity"</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"debug"</span>)
.long(<span class="string">"debug"</span>)
.action(ArgAction::SetTrue)
.groups([<span class="string">"mode"</span>, <span class="string">"verbosity"</span>]))
.arg(Arg::new(<span class="string">"verbose"</span>)
.long(<span class="string">"verbose"</span>)
.action(ArgAction::SetTrue)
.groups([<span class="string">"mode"</span>, <span class="string">"verbosity"</span>]))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--debug"
</span>]);
<span class="macro">assert!</span>(m.contains_id(<span class="string">"mode"</span>));
<span class="macro">assert!</span>(m.contains_id(<span class="string">"verbosity"</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.default_value_if" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#2848-2853">source</a><h4 class="code-header">pub fn <a href="#method.default_value_if" class="fn">default_value_if</a>(
self,
arg_id: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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;,
predicate: impl <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="enum.ArgPredicate.html" title="enum clap::builder::ArgPredicate">ArgPredicate</a>&gt;,
default: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;,
) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.Arg.html#method.default_value" title="method clap::Arg::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>Like with command-line values, this will be split by <a href="../struct.Arg.html#method.value_delimiter" title="method clap::Arg::value_delimiter"><code>Arg::value_delimiter</code></a>.</p>
<h5 id="examples-42"><a class="doc-anchor" href="#examples-42">§</a>Examples</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"flag"</span>)
.long(<span class="string">"flag"</span>)
.action(ArgAction::SetTrue))
.arg(Arg::new(<span class="string">"other"</span>)
.long(<span class="string">"other"</span>)
.default_value_if(<span class="string">"flag"</span>, ArgPredicate::IsPresent, <span class="prelude-val">Some</span>(<span class="string">"default"</span>)))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--flag"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"other"</span>).unwrap(), <span class="string">"default"</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"flag"</span>)
.long(<span class="string">"flag"</span>)
.action(ArgAction::SetTrue))
.arg(Arg::new(<span class="string">"other"</span>)
.long(<span class="string">"other"</span>)
.default_value_if(<span class="string">"flag"</span>, <span class="string">"true"</span>, <span class="prelude-val">Some</span>(<span class="string">"default"</span>)))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"other"</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"opt"</span>)
.action(ArgAction::Set)
.long(<span class="string">"opt"</span>))
.arg(Arg::new(<span class="string">"other"</span>)
.long(<span class="string">"other"</span>)
.default_value_if(<span class="string">"opt"</span>, <span class="string">"special"</span>, <span class="prelude-val">Some</span>(<span class="string">"default"</span>)))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--opt"</span>, <span class="string">"special"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"other"</span>).unwrap(), <span class="string">"default"</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"opt"</span>)
.action(ArgAction::Set)
.long(<span class="string">"opt"</span>))
.arg(Arg::new(<span class="string">"other"</span>)
.long(<span class="string">"other"</span>)
.default_value_if(<span class="string">"opt"</span>, <span class="string">"special"</span>, <span class="prelude-val">Some</span>(<span class="string">"default"</span>)))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--opt"</span>, <span class="string">"hahaha"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"other"</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"flag"</span>)
.long(<span class="string">"flag"</span>)
.action(ArgAction::SetTrue))
.arg(Arg::new(<span class="string">"other"</span>)
.long(<span class="string">"other"</span>)
.default_value(<span class="string">"default"</span>)
.default_value_if(<span class="string">"flag"</span>, <span class="string">"true"</span>, <span class="prelude-val">None</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--flag"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"other"</span>), <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.default_value_ifs" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#2964-2973">source</a><h4 class="code-header">pub fn <a href="#method.default_value_ifs" class="fn">default_value_ifs</a>(
self,
ifs: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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.80.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.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="enum.ArgPredicate.html" title="enum clap::builder::ArgPredicate">ArgPredicate</a>&gt;, impl <a class="trait" href="trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;)&gt;,
) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Specifies multiple values and conditions in the same manner as <a href="../struct.Arg.html#method.default_value_if" title="method clap::Arg::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>
<p>Like with command-line values, this will be split by <a href="../struct.Arg.html#method.value_delimiter" title="method clap::Arg::value_delimiter"><code>Arg::value_delimiter</code></a>.</p>
<h5 id="examples-43"><a class="doc-anchor" href="#examples-43">§</a>Examples</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"flag"</span>)
.long(<span class="string">"flag"</span>)
.action(ArgAction::SetTrue))
.arg(Arg::new(<span class="string">"opt"</span>)
.long(<span class="string">"opt"</span>)
.action(ArgAction::Set))
.arg(Arg::new(<span class="string">"other"</span>)
.long(<span class="string">"other"</span>)
.default_value_ifs([
(<span class="string">"flag"</span>, <span class="string">"true"</span>, <span class="prelude-val">Some</span>(<span class="string">"default"</span>)),
(<span class="string">"opt"</span>, <span class="string">"channal"</span>, <span class="prelude-val">Some</span>(<span class="string">"chan"</span>)),
]))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--opt"</span>, <span class="string">"channal"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"other"</span>).unwrap(), <span class="string">"chan"</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"flag"</span>)
.long(<span class="string">"flag"</span>)
.action(ArgAction::SetTrue))
.arg(Arg::new(<span class="string">"other"</span>)
.long(<span class="string">"other"</span>)
.default_value_ifs([
(<span class="string">"flag"</span>, <span class="string">"true"</span>, <span class="prelude-val">Some</span>(<span class="string">"default"</span>)),
(<span class="string">"opt"</span>, <span class="string">"channal"</span>, <span class="prelude-val">Some</span>(<span class="string">"chan"</span>)),
]))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"other"</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>m = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"flag"</span>)
.long(<span class="string">"flag"</span>)
.action(ArgAction::SetTrue))
.arg(Arg::new(<span class="string">"opt"</span>)
.long(<span class="string">"opt"</span>)
.action(ArgAction::Set))
.arg(Arg::new(<span class="string">"other"</span>)
.long(<span class="string">"other"</span>)
.default_value_ifs([
(<span class="string">"flag"</span>, ArgPredicate::IsPresent, <span class="prelude-val">Some</span>(<span class="string">"default"</span>)),
(<span class="string">"opt"</span>, ArgPredicate::Equals(<span class="string">"channal"</span>.into()), <span class="prelude-val">Some</span>(<span class="string">"chan"</span>)),
]))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--opt"</span>, <span class="string">"channal"</span>, <span class="string">"--flag"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"other"</span>).unwrap(), <span class="string">"default"</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.required_unless_present" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3056">source</a><h4 class="code-header">pub fn <a href="#method.required_unless_present" class="fn">required_unless_present</a>(self, arg_id: impl <a class="trait" href="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; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Set this arg as <a href="../struct.Arg.html#method.required" title="method clap::Arg::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="../struct.Arg.html#method.required" title="method clap::Arg::required"><code>Arg::required</code></a> and is therefore not
mandatory to also set.</p>
<h5 id="examples-44"><a class="doc-anchor" href="#examples-44">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"config"</span>)
.required_unless_present(<span class="string">"debug"</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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.required_unless_present(<span class="string">"dbg"</span>)
.action(ArgAction::Set)
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"dbg"</span>)
.long(<span class="string">"debug"</span>)
.action(ArgAction::SetTrue))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--debug"
</span>]);
<span class="macro">assert!</span>(res.is_ok());</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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.required_unless_present(<span class="string">"dbg"</span>)
.action(ArgAction::Set)
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"dbg"</span>)
.long(<span class="string">"debug"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::MissingRequiredArgument);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.required_unless_present_all" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3136-3139">source</a><h4 class="code-header">pub fn <a href="#method.required_unless_present_all" class="fn">required_unless_present_all</a>(
self,
names: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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.80.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; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Sets this arg as <a href="../struct.Arg.html#method.required" title="method clap::Arg::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="../struct.Arg.html#method.required_unless_present_any" title="method clap::Arg::required_unless_present_any"><code>Arg::required_unless_present_any</code></a></p>
<h5 id="examples-45"><a class="doc-anchor" href="#examples-45">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"config"</span>)
.required_unless_present_all([<span class="string">"cfg"</span>, <span class="string">"dbg"</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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.required_unless_present_all([<span class="string">"dbg"</span>, <span class="string">"infile"</span>])
.action(ArgAction::Set)
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"dbg"</span>)
.long(<span class="string">"debug"</span>)
.action(ArgAction::SetTrue))
.arg(Arg::new(<span class="string">"infile"</span>)
.short(<span class="string">'i'</span>)
.action(ArgAction::Set))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--debug"</span>, <span class="string">"-i"</span>, <span class="string">"file"
</span>]);
<span class="macro">assert!</span>(res.is_ok());</code></pre></div>
<p>Setting <a href="../struct.Arg.html#method.required_unless_present_all" title="method clap::Arg::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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.required_unless_present_all([<span class="string">"dbg"</span>, <span class="string">"infile"</span>])
.action(ArgAction::Set)
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"dbg"</span>)
.long(<span class="string">"debug"</span>)
.action(ArgAction::SetTrue))
.arg(Arg::new(<span class="string">"infile"</span>)
.short(<span class="string">'i'</span>)
.action(ArgAction::Set))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::MissingRequiredArgument);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.required_unless_present_any" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3217-3220">source</a><h4 class="code-header">pub fn <a href="#method.required_unless_present_any" class="fn">required_unless_present_any</a>(
self,
names: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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.80.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; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Sets this arg as <a href="../struct.Arg.html#method.required" title="method clap::Arg::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="../struct.Arg.html#method.required_unless_present_all" title="method clap::Arg::required_unless_present_all"><code>Arg::required_unless_present_all</code></a></p>
<h5 id="examples-46"><a class="doc-anchor" href="#examples-46">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"config"</span>)
.required_unless_present_any([<span class="string">"cfg"</span>, <span class="string">"dbg"</span>])</code></pre></div>
<p>Setting <a href="../struct.Arg.html#method.required_unless_present_any" title="method clap::Arg::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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.required_unless_present_any([<span class="string">"dbg"</span>, <span class="string">"infile"</span>])
.action(ArgAction::Set)
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"dbg"</span>)
.long(<span class="string">"debug"</span>)
.action(ArgAction::SetTrue))
.arg(Arg::new(<span class="string">"infile"</span>)
.short(<span class="string">'i'</span>)
.action(ArgAction::Set))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--debug"
</span>]);
<span class="macro">assert!</span>(res.is_ok());</code></pre></div>
<p>Setting <a href="../struct.Arg.html#method.required_unless_present_any" title="method clap::Arg::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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.required_unless_present_any([<span class="string">"dbg"</span>, <span class="string">"infile"</span>])
.action(ArgAction::Set)
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"dbg"</span>)
.long(<span class="string">"debug"</span>)
.action(ArgAction::SetTrue))
.arg(Arg::new(<span class="string">"infile"</span>)
.short(<span class="string">'i'</span>)
.action(ArgAction::Set))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::MissingRequiredArgument);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.required_if_eq" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3307">source</a><h4 class="code-header">pub fn <a href="#method.required_if_eq" class="fn">required_if_eq</a>(self, arg_id: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>This argument is <a href="../struct.Arg.html#method.required" title="method clap::Arg::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 class="doc-anchor" href="#examples-47">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"config"</span>)
.required_if_eq(<span class="string">"other_arg"</span>, <span class="string">"value"</span>)</code></pre></div>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.action(ArgAction::Set)
.required_if_eq(<span class="string">"other"</span>, <span class="string">"special"</span>)
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"other"</span>)
.long(<span class="string">"other"</span>)
.action(ArgAction::Set))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--other"</span>, <span class="string">"not-special"
</span>]);
<span class="macro">assert!</span>(res.is_ok()); <span class="comment">// We didn't use --other=special, so "cfg" wasn't required
</span><span class="kw">let </span>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.action(ArgAction::Set)
.required_if_eq(<span class="string">"other"</span>, <span class="string">"special"</span>)
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"other"</span>)
.long(<span class="string">"other"</span>)
.action(ArgAction::Set))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--other"</span>, <span class="string">"special"
</span>]);
<span class="comment">// We did use --other=special so "cfg" had become required but was missing.
</span><span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::MissingRequiredArgument);
<span class="kw">let </span>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.action(ArgAction::Set)
.required_if_eq(<span class="string">"other"</span>, <span class="string">"special"</span>)
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"other"</span>)
.long(<span class="string">"other"</span>)
.action(ArgAction::Set))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--other"</span>, <span class="string">"SPECIAL"
</span>]);
<span class="comment">// By default, the comparison is case-sensitive, so "cfg" wasn't required
</span><span class="macro">assert!</span>(res.is_ok());
<span class="kw">let </span>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.action(ArgAction::Set)
.required_if_eq(<span class="string">"other"</span>, <span class="string">"special"</span>)
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"other"</span>)
.long(<span class="string">"other"</span>)
.ignore_case(<span class="bool-val">true</span>)
.action(ArgAction::Set))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--other"</span>, <span class="string">"SPECIAL"
</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>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::MissingRequiredArgument);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.required_if_eq_any" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3389-3392">source</a><h4 class="code-header">pub fn <a href="#method.required_if_eq_any" class="fn">required_if_eq_any</a>(
self,
ifs: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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.80.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.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;)&gt;,
) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Specify this argument is <a href="../struct.Arg.html#method.required" title="method clap::Arg::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 class="doc-anchor" href="#examples-48">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"config"</span>)
.required_if_eq_any([
(<span class="string">"extra"</span>, <span class="string">"val"</span>),
(<span class="string">"option"</span>, <span class="string">"spec"</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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.required_if_eq_any([
(<span class="string">"extra"</span>, <span class="string">"val"</span>),
(<span class="string">"option"</span>, <span class="string">"spec"</span>)
])
.action(ArgAction::Set)
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"extra"</span>)
.action(ArgAction::Set)
.long(<span class="string">"extra"</span>))
.arg(Arg::new(<span class="string">"option"</span>)
.action(ArgAction::Set)
.long(<span class="string">"option"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--option"</span>, <span class="string">"other"
</span>]);
<span class="macro">assert!</span>(res.is_ok()); <span class="comment">// We didn't use --option=spec, or --extra=val so "cfg" isn'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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.required_if_eq_any([
(<span class="string">"extra"</span>, <span class="string">"val"</span>),
(<span class="string">"option"</span>, <span class="string">"spec"</span>)
])
.action(ArgAction::Set)
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"extra"</span>)
.action(ArgAction::Set)
.long(<span class="string">"extra"</span>))
.arg(Arg::new(<span class="string">"option"</span>)
.action(ArgAction::Set)
.long(<span class="string">"option"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--option"</span>, <span class="string">"spec"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::MissingRequiredArgument);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.required_if_eq_all" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3473-3476">source</a><h4 class="code-header">pub fn <a href="#method.required_if_eq_all" class="fn">required_if_eq_all</a>(
self,
ifs: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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.80.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.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.OsStr.html" title="struct clap::builder::OsStr">OsStr</a>&gt;)&gt;,
) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Specify this argument is <a href="../struct.Arg.html#method.required" title="method clap::Arg::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 class="doc-anchor" href="#examples-49">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"config"</span>)
.required_if_eq_all([
(<span class="string">"extra"</span>, <span class="string">"val"</span>),
(<span class="string">"option"</span>, <span class="string">"spec"</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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.required_if_eq_all([
(<span class="string">"extra"</span>, <span class="string">"val"</span>),
(<span class="string">"option"</span>, <span class="string">"spec"</span>)
])
.action(ArgAction::Set)
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"extra"</span>)
.action(ArgAction::Set)
.long(<span class="string">"extra"</span>))
.arg(Arg::new(<span class="string">"option"</span>)
.action(ArgAction::Set)
.long(<span class="string">"option"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--option"</span>, <span class="string">"spec"
</span>]);
<span class="macro">assert!</span>(res.is_ok()); <span class="comment">// We didn't use --option=spec --extra=val so "cfg" isn'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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.required_if_eq_all([
(<span class="string">"extra"</span>, <span class="string">"val"</span>),
(<span class="string">"option"</span>, <span class="string">"spec"</span>)
])
.action(ArgAction::Set)
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"extra"</span>)
.action(ArgAction::Set)
.long(<span class="string">"extra"</span>))
.arg(Arg::new(<span class="string">"option"</span>)
.action(ArgAction::Set)
.long(<span class="string">"option"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--extra"</span>, <span class="string">"val"</span>, <span class="string">"--option"</span>, <span class="string">"spec"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::MissingRequiredArgument);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.requires_if" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3541">source</a><h4 class="code-header">pub fn <a href="#method.requires_if" class="fn">requires_if</a>(
self,
val: impl <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="enum.ArgPredicate.html" title="enum clap::builder::ArgPredicate">ArgPredicate</a>&gt;,
arg_id: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>Require another argument if this arg matches the <a href="enum.ArgPredicate.html" title="enum clap::builder::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="enum.ArgPredicate.html" title="enum clap::builder::ArgPredicate"><code>ArgPredicate</code></a>.
If it does, <code>another_arg</code> will be marked as required.</p>
<h5 id="examples-50"><a class="doc-anchor" href="#examples-50">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"config"</span>)
.requires_if(<span class="string">"val"</span>, <span class="string">"arg"</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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.action(ArgAction::Set)
.requires_if(<span class="string">"my.cfg"</span>, <span class="string">"other"</span>)
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"other"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--config"</span>, <span class="string">"some.cfg"
</span>]);
<span class="macro">assert!</span>(res.is_ok()); <span class="comment">// We didn't use --config=my.cfg, so other wasn'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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.action(ArgAction::Set)
.requires_if(<span class="string">"my.cfg"</span>, <span class="string">"input"</span>)
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"input"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--config"</span>, <span class="string">"my.cfg"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::MissingRequiredArgument);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.requires_ifs" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3620-3623">source</a><h4 class="code-header">pub fn <a href="#method.requires_ifs" class="fn">requires_ifs</a>(
self,
ifs: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="enum.ArgPredicate.html" title="enum clap::builder::ArgPredicate">ArgPredicate</a>&gt;, impl <a class="trait" href="https://doc.rust-lang.org/1.80.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; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="enum.ArgPredicate.html" title="enum clap::builder::ArgPredicate"><code>ArgPredicate</code></a>.</p>
<h5 id="examples-51"><a class="doc-anchor" href="#examples-51">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"config"</span>)
.requires_ifs([
(<span class="string">"val"</span>, <span class="string">"arg"</span>),
(<span class="string">"other_val"</span>, <span class="string">"arg2"</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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.action(ArgAction::Set)
.requires_ifs([
(<span class="string">"special.conf"</span>, <span class="string">"opt"</span>),
(<span class="string">"other.conf"</span>, <span class="string">"other"</span>),
])
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"opt"</span>)
.long(<span class="string">"option"</span>)
.action(ArgAction::Set))
.arg(Arg::new(<span class="string">"other"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--config"</span>, <span class="string">"special.conf"
</span>]);
<span class="macro">assert!</span>(res.is_err()); <span class="comment">// We used --config=special.conf so --option &lt;val&gt; is required
</span><span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::MissingRequiredArgument);</code></pre></div>
<p>Setting <code>Arg::requires_ifs</code> with <a href="enum.ArgPredicate.html#variant.IsPresent" title="variant clap::builder::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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.action(ArgAction::Set)
.requires_ifs([
(ArgPredicate::IsPresent, <span class="string">"input"</span>),
(ArgPredicate::IsPresent, <span class="string">"output"</span>),
])
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"input"</span>))
.arg(Arg::new(<span class="string">"output"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--config"</span>, <span class="string">"file.conf"</span>, <span class="string">"in.txt"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="comment">// We didn't use output
</span><span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::MissingRequiredArgument);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.conflicts_with" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3687">source</a><h4 class="code-header">pub fn <a href="#method.conflicts_with" class="fn">conflicts_with</a>(self, arg_id: impl <a class="trait" href="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; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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 <code>A.conflicts_with(B)</code> is sufficient. You do not
need to also do <code>B.conflicts_with(A)</code>)</p>
<p><strong>NOTE:</strong> <a href="../struct.Arg.html#method.conflicts_with_all" title="method clap::Arg::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="../struct.Arg.html#method.exclusive" title="method clap::Arg::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 class="doc-anchor" href="#examples-52">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"config"</span>)
.conflicts_with(<span class="string">"debug"</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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.action(ArgAction::Set)
.conflicts_with(<span class="string">"debug"</span>)
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"debug"</span>)
.long(<span class="string">"debug"</span>)
.action(ArgAction::SetTrue))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--debug"</span>, <span class="string">"--config"</span>, <span class="string">"file.conf"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::ArgumentConflict);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.conflicts_with_all" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3743">source</a><h4 class="code-header">pub fn <a href="#method.conflicts_with_all" class="fn">conflicts_with_all</a>(
self,
names: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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.80.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; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class="docblock"><p>This argument is mutually exclusive with the specified arguments.</p>
<p>See <a href="../struct.Arg.html#method.conflicts_with" title="method clap::Arg::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 <code>A.conflicts_with(B)</code> is sufficient. You do not need
need to also do <code>B.conflicts_with(A)</code>)</p>
<p><strong>NOTE:</strong> <a href="../struct.Arg.html#method.exclusive" title="method clap::Arg::exclusive"><code>Arg::exclusive(true)</code></a> allows specifying an argument which conflicts with every other argument.</p>
<h5 id="examples-53"><a class="doc-anchor" href="#examples-53">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Arg::new(<span class="string">"config"</span>)
.conflicts_with_all([<span class="string">"debug"</span>, <span class="string">"input"</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>res = Command::new(<span class="string">"prog"</span>)
.arg(Arg::new(<span class="string">"cfg"</span>)
.action(ArgAction::Set)
.conflicts_with_all([<span class="string">"debug"</span>, <span class="string">"input"</span>])
.long(<span class="string">"config"</span>))
.arg(Arg::new(<span class="string">"debug"</span>)
.long(<span class="string">"debug"</span>))
.arg(Arg::new(<span class="string">"input"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--config"</span>, <span class="string">"file.conf"</span>, <span class="string">"file.txt"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::ArgumentConflict);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.overrides_with" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3780">source</a><h4 class="code-header">pub fn <a href="#method.overrides_with" class="fn">overrides_with</a>(self, arg_id: impl <a class="trait" href="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; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.Arg.html#method.conflicts_with" title="method clap::Arg::conflicts_with">conflict</a>.</p>
<h5 id="examples-54"><a class="doc-anchor" href="#examples-54">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.arg(<span class="macro">arg!</span>(-f --flag <span class="string">"some flag"</span>)
.conflicts_with(<span class="string">"debug"</span>))
.arg(<span class="macro">arg!</span>(-d --debug <span class="string">"other flag"</span>))
.arg(<span class="macro">arg!</span>(-c --color <span class="string">"third flag"</span>)
.overrides_with(<span class="string">"flag"</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"-f"</span>, <span class="string">"-d"</span>, <span class="string">"-c"</span>]);
<span class="comment">// ^~~~~~~~~~~~^~~~~ flag is overridden by color
</span><span class="macro">assert!</span>(m.get_flag(<span class="string">"color"</span>));
<span class="macro">assert!</span>(m.get_flag(<span class="string">"debug"</span>)); <span class="comment">// even though flag conflicts with debug, it's as if flag
// was never used because it was overridden with color
</span><span class="macro">assert!</span>(!m.get_flag(<span class="string">"flag"</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.overrides_with_all" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3821">source</a><h4 class="code-header">pub fn <a href="#method.overrides_with_all" class="fn">overrides_with_all</a>(
self,
names: impl <a class="trait" href="https://doc.rust-lang.org/1.80.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.80.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; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></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="../struct.Arg.html#method.conflicts_with_all" title="method clap::Arg::conflicts_with_all">conflict</a>.</p>
<h5 id="examples-55"><a class="doc-anchor" href="#examples-55">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.arg(<span class="macro">arg!</span>(-f --flag <span class="string">"some flag"</span>)
.conflicts_with(<span class="string">"color"</span>))
.arg(<span class="macro">arg!</span>(-d --debug <span class="string">"other flag"</span>))
.arg(<span class="macro">arg!</span>(-c --color <span class="string">"third flag"</span>)
.overrides_with_all([<span class="string">"flag"</span>, <span class="string">"debug"</span>]))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"-f"</span>, <span class="string">"-d"</span>, <span class="string">"-c"</span>]);
<span class="comment">// ^~~~~~^~~~~~~~~ flag and debug are overridden by color
</span><span class="macro">assert!</span>(m.get_flag(<span class="string">"color"</span>)); <span class="comment">// even though flag conflicts with color, it's as if flag
// and debug were never used because they were overridden
// with color
</span><span class="macro">assert!</span>(!m.get_flag(<span class="string">"debug"</span>));
<span class="macro">assert!</span>(!m.get_flag(<span class="string">"flag"</span>));</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Arg-4" class="impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3828">source</a><a href="#impl-Arg-4" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h3></section></summary><div class="docblock"><h4 id="reflection"><a class="doc-anchor" href="#reflection">§</a>Reflection</h4></div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.get_id" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3831">source</a><h4 class="code-header">pub fn <a href="#method.get_id" class="fn">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="toggle method-toggle" open><summary><section id="method.get_help" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3837">source</a><h4 class="code-header">pub fn <a href="#method.get_help" class="fn">get_help</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="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="toggle method-toggle" open><summary><section id="method.get_long_help" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3853">source</a><h4 class="code-header">pub fn <a href="#method.get_long_help" class="fn">get_long_help</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="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 class="doc-anchor" href="#examples-56">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>arg = Arg::new(<span class="string">"foo"</span>).long_help(<span class="string">"long help"</span>);
<span class="macro">assert_eq!</span>(<span class="prelude-val">Some</span>(<span class="string">"long help"</span>.to_owned()), arg.get_long_help().map(|s| s.to_string()));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_help_heading" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3859">source</a><h4 class="code-header">pub fn <a href="#method.get_help_heading" class="fn">get_help_heading</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.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.80.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="toggle method-toggle" open><summary><section id="method.get_short" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3868">source</a><h4 class="code-header">pub fn <a href="#method.get_short" class="fn">get_short</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.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="toggle method-toggle" open><summary><section id="method.get_visible_short_aliases" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3874">source</a><h4 class="code-header">pub fn <a href="#method.get_visible_short_aliases" class="fn">get_visible_short_aliases</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.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="toggle method-toggle" open><summary><section id="method.get_all_short_aliases" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3890">source</a><h4 class="code-header">pub fn <a href="#method.get_all_short_aliases" class="fn">get_all_short_aliases</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.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="toggle method-toggle" open><summary><section id="method.get_short_and_visible_aliases" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3900">source</a><h4 class="code-header">pub fn <a href="#method.get_short_and_visible_aliases" class="fn">get_short_and_visible_aliases</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.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="toggle method-toggle" open><summary><section id="method.get_long" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3913">source</a><h4 class="code-header">pub fn <a href="#method.get_long" class="fn">get_long</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.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.80.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="toggle method-toggle" open><summary><section id="method.get_visible_aliases" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3919">source</a><h4 class="code-header">pub fn <a href="#method.get_visible_aliases" class="fn">get_visible_aliases</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.80.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.80.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="toggle method-toggle" open><summary><section id="method.get_all_aliases" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3934">source</a><h4 class="code-header">pub fn <a href="#method.get_all_aliases" class="fn">get_all_aliases</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.80.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.80.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="toggle method-toggle" open><summary><section id="method.get_long_and_visible_aliases" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3944">source</a><h4 class="code-header">pub fn <a href="#method.get_long_and_visible_aliases" class="fn">get_long_and_visible_aliases</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.80.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.80.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="toggle method-toggle" open><summary><section id="method.get_aliases" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3957">source</a><h4 class="code-header">pub fn <a href="#method.get_aliases" class="fn">get_aliases</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.80.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.80.0/std/primitive.str.html">str</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Get hidden aliases for this argument, if any</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_possible_values" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3972">source</a><h4 class="code-header">pub fn <a href="#method.get_possible_values" class="fn">get_possible_values</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="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="toggle method-toggle" open><summary><section id="method.get_value_names" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3985">source</a><h4 class="code-header">pub fn <a href="#method.get_value_names" class="fn">get_value_names</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;[<a class="struct" href="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="toggle method-toggle" open><summary><section id="method.get_num_args" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3995">source</a><h4 class="code-header">pub fn <a href="#method.get_num_args" class="fn">get_num_args</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="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="toggle method-toggle" open><summary><section id="method.get_value_delimiter" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4006">source</a><h4 class="code-header">pub fn <a href="#method.get_value_delimiter" class="fn">get_value_delimiter</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.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="toggle method-toggle" open><summary><section id="method.get_value_terminator" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4013">source</a><h4 class="code-header">pub fn <a href="#method.get_value_terminator" class="fn">get_value_terminator</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;</h4></section></summary><div class="docblock"><p>Get the value terminator for this argument. The <code>value_terminator</code> is a value
that terminates parsing of multi-valued arguments.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_index" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4019">source</a><h4 class="code-header">pub fn <a href="#method.get_index" class="fn">get_index</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.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="toggle method-toggle" open><summary><section id="method.get_value_hint" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4024">source</a><h4 class="code-header">pub fn <a href="#method.get_value_hint" class="fn">get_value_hint</a>(&amp;self) -&gt; <a class="enum" href="../enum.ValueHint.html" title="enum clap::ValueHint">ValueHint</a></h4></section></summary><div class="docblock"><p>Get the value hint of this argument</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_default_values" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4065">source</a><h4 class="code-header">pub fn <a href="#method.get_default_values" class="fn">get_default_values</a>(&amp;self) -&gt; &amp;[<a class="struct" href="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 class="doc-anchor" href="#examples-57">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>arg = Arg::new(<span class="string">"foo"</span>).default_value(<span class="string">"default value"</span>);
<span class="macro">assert_eq!</span>(arg.get_default_values(), <span class="kw-2">&amp;</span>[<span class="string">"default value"</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_positional" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4082">source</a><h4 class="code-header">pub fn <a href="#method.is_positional" class="fn">is_positional</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.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 class="doc-anchor" href="#examples-58">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>arg = Arg::new(<span class="string">"foo"</span>);
<span class="macro">assert_eq!</span>(arg.is_positional(), <span class="bool-val">true</span>);
<span class="kw">let </span>arg = Arg::new(<span class="string">"foo"</span>).long(<span class="string">"foo"</span>);
<span class="macro">assert_eq!</span>(arg.is_positional(), <span class="bool-val">false</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_required_set" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4087">source</a><h4 class="code-header">pub fn <a href="#method.is_required_set" class="fn">is_required_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Reports whether <a href="../struct.Arg.html#method.required" title="method clap::Arg::required"><code>Arg::required</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_allow_hyphen_values_set" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4102">source</a><h4 class="code-header">pub fn <a href="#method.is_allow_hyphen_values_set" class="fn">is_allow_hyphen_values_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="../struct.Arg.html#method.allow_hyphen_values" title="method clap::Arg::allow_hyphen_values"><code>Arg::allow_hyphen_values</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_allow_negative_numbers_set" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4107">source</a><h4 class="code-header">pub fn <a href="#method.is_allow_negative_numbers_set" class="fn">is_allow_negative_numbers_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="../struct.Arg.html#method.allow_negative_numbers" title="method clap::Arg::allow_negative_numbers"><code>Arg::allow_negative_numbers</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_action" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4112">source</a><h4 class="code-header">pub fn <a href="#method.get_action" class="fn">get_action</a>(&amp;self) -&gt; &amp;<a class="enum" href="../enum.ArgAction.html" title="enum clap::ArgAction">ArgAction</a></h4></section></summary><div class="docblock"><p>Behavior when parsing the argument</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_value_parser" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4133">source</a><h4 class="code-header">pub fn <a href="#method.get_value_parser" class="fn">get_value_parser</a>(&amp;self) -&gt; &amp;<a class="struct" href="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 class="doc-anchor" href="#example">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>cmd = clap::Command::new(<span class="string">"raw"</span>)
.arg(
clap::Arg::new(<span class="string">"port"</span>)
.value_parser(<span class="macro">clap::value_parser!</span>(usize))
);
<span class="kw">let </span>value_parser = cmd.get_arguments()
.find(|a| a.get_id() == <span class="string">"port"</span>).unwrap()
.get_value_parser();
<span class="macro">println!</span>(<span class="string">"{value_parser:?}"</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_global_set" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4143">source</a><h4 class="code-header">pub fn <a href="#method.is_global_set" class="fn">is_global_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="../struct.Arg.html#method.global" title="method clap::Arg::global"><code>Arg::global</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_next_line_help_set" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4148">source</a><h4 class="code-header">pub fn <a href="#method.is_next_line_help_set" class="fn">is_next_line_help_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="../struct.Arg.html#method.next_line_help" title="method clap::Arg::next_line_help"><code>Arg::next_line_help</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_hide_set" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4153">source</a><h4 class="code-header">pub fn <a href="#method.is_hide_set" class="fn">is_hide_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="../struct.Arg.html#method.hide" title="method clap::Arg::hide"><code>Arg::hide</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_hide_default_value_set" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4158">source</a><h4 class="code-header">pub fn <a href="#method.is_hide_default_value_set" class="fn">is_hide_default_value_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="../struct.Arg.html#method.hide_default_value" title="method clap::Arg::hide_default_value"><code>Arg::hide_default_value</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_hide_possible_values_set" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4163">source</a><h4 class="code-header">pub fn <a href="#method.is_hide_possible_values_set" class="fn">is_hide_possible_values_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="../struct.Arg.html#method.hide_possible_values" title="method clap::Arg::hide_possible_values"><code>Arg::hide_possible_values</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_hide_short_help_set" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4180">source</a><h4 class="code-header">pub fn <a href="#method.is_hide_short_help_set" class="fn">is_hide_short_help_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="../struct.Arg.html#method.hide_short_help" title="method clap::Arg::hide_short_help"><code>Arg::hide_short_help</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_hide_long_help_set" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4185">source</a><h4 class="code-header">pub fn <a href="#method.is_hide_long_help_set" class="fn">is_hide_long_help_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="../struct.Arg.html#method.hide_long_help" title="method clap::Arg::hide_long_help"><code>Arg::hide_long_help</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_require_equals_set" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4190">source</a><h4 class="code-header">pub fn <a href="#method.is_require_equals_set" class="fn">is_require_equals_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="../struct.Arg.html#method.require_equals" title="method clap::Arg::require_equals"><code>Arg::require_equals</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_exclusive_set" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4195">source</a><h4 class="code-header">pub fn <a href="#method.is_exclusive_set" class="fn">is_exclusive_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Reports whether <a href="../struct.Arg.html#method.exclusive" title="method clap::Arg::exclusive"><code>Arg::exclusive</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_trailing_var_arg_set" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4200">source</a><h4 class="code-header">pub fn <a href="#method.is_trailing_var_arg_set" class="fn">is_trailing_var_arg_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="../struct.Arg.html#method.trailing_var_arg" title="method clap::Arg::trailing_var_arg"><code>Arg::trailing_var_arg</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_last_set" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4205">source</a><h4 class="code-header">pub fn <a href="#method.is_last_set" class="fn">is_last_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Reports whether <a href="../struct.Arg.html#method.last" title="method clap::Arg::last"><code>Arg::last</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_ignore_case_set" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4210">source</a><h4 class="code-header">pub fn <a href="#method.is_ignore_case_set" class="fn">is_ignore_case_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Reports whether <a href="../struct.Arg.html#method.ignore_case" title="method clap::Arg::ignore_case"><code>Arg::ignore_case</code></a> is set</p>
</div></details></div></details><section id="impl-Arg-5" class="impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4216">source</a><a href="#impl-Arg-5" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="../struct.Arg.html" title="struct clap::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 class="doc-anchor" href="#internally-used-only">§</a>Internally used only</h4></div></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Clone-for-Arg" class="impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#56">source</a><a href="#impl-Clone-for-Arg" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#56">source</a><a href="#method.clone" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&amp;self) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class='docblock'>Returns a copy of the value. <a href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html#tymethod.clone">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.80.0/src/core/clone.rs.html#169">source</a></span><a href="#method.clone_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html#method.clone_from" class="fn">clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;Self</a>)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html#method.clone_from">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-Arg" class="impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4456">source</a><a href="#impl-Debug-for-Arg" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4457">source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.80.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.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.80.0/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.80.0/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-Arg" class="impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#56">source</a><a href="#impl-Default-for-Arg" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#56">source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.80.0/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Display-for-Arg" class="impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4449">source</a><a href="#impl-Display-for-Arg" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt-1" class="method trait-impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4450">source</a><a href="#method.fmt-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/fmt/trait.Display.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.80.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.80.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.80.0/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.80.0/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3C%26Arg%3E-for-Arg" class="impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4423">source</a><a href="#impl-From%3C%26Arg%3E-for-Arg" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;&amp;<a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a>&gt; for <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4424">source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(a: &amp;<a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a>) -&gt; <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Ord-for-Arg" class="impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4441">source</a><a href="#impl-Ord-for-Arg" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> for <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.cmp" class="method trait-impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4442">source</a><a href="#method.cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html#tymethod.cmp" class="fn">cmp</a>(&amp;self, other: &amp;<a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></h4></section></summary><div class='docblock'>This method returns an <a href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering"><code>Ordering</code></a> between <code>self</code> and <code>other</code>. <a href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html#tymethod.cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.max" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="src" href="https://doc.rust-lang.org/1.80.0/src/core/cmp.rs.html#856-858">source</a></span><a href="#method.max" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html#method.max" class="fn">max</a>(self, other: Self) -&gt; Self<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Compares and returns the maximum of two values. <a href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html#method.max">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.min" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="src" href="https://doc.rust-lang.org/1.80.0/src/core/cmp.rs.html#877-879">source</a></span><a href="#method.min" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html#method.min" class="fn">min</a>(self, other: Self) -&gt; Self<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Compares and returns the minimum of two values. <a href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html#method.min">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clamp" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.50.0">1.50.0</span> · <a class="src" href="https://doc.rust-lang.org/1.80.0/src/core/cmp.rs.html#903-906">source</a></span><a href="#method.clamp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html#method.clamp" class="fn">clamp</a>(self, min: Self, max: Self) -&gt; Self<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>,</div></h4></section></summary><div class='docblock'>Restrict a value to a certain interval. <a href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Ord.html#method.clamp">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq-for-Arg" class="impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4429">source</a><a href="#impl-PartialEq-for-Arg" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a> for <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq" class="method trait-impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4430">source</a><a href="#method.eq" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&amp;self, other: &amp;<a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.80.0/src/core/cmp.rs.html#263">source</a></span><a href="#method.ne" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
sufficient, and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd-for-Arg" class="impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4435">source</a><a href="#impl-PartialOrd-for-Arg" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a> for <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp" class="method trait-impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4436">source</a><a href="#method.partial_cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&amp;self, other: &amp;<a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.80.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>&gt;</h4></section></summary><div class='docblock'>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.80.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.lt" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.80.0/src/core/cmp.rs.html#1180">source</a></span><a href="#method.lt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>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.80.0/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.80.0/src/core/cmp.rs.html#1198">source</a></span><a href="#method.le" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>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.80.0/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.80.0/src/core/cmp.rs.html#1215">source</a></span><a href="#method.gt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>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.80.0/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.80.0/src/core/cmp.rs.html#1233">source</a></span><a href="#method.ge" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>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.80.0/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><section id="impl-Eq-for-Arg" class="impl"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#4447">source</a><a href="#impl-Eq-for-Arg" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h3></section></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-Arg" class="impl"><a href="#impl-Freeze-for-Arg" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h3></section><section id="impl-RefUnwindSafe-for-Arg" class="impl"><a href="#impl-RefUnwindSafe-for-Arg" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/1.80.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h3></section><section id="impl-Send-for-Arg" class="impl"><a href="#impl-Send-for-Arg" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h3></section><section id="impl-Sync-for-Arg" class="impl"><a href="#impl-Sync-for-Arg" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h3></section><section id="impl-Unpin-for-Arg" class="impl"><a href="#impl-Unpin-for-Arg" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h3></section><section id="impl-UnwindSafe-for-Arg" class="impl"><a href="#impl-UnwindSafe-for-Arg" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/1.80.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../struct.Arg.html" title="struct clap::Arg">Arg</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/any.rs.html#141">source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.80.0/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/borrow.rs.html#208">source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/borrow.rs.html#210">source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.80.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/borrow.rs.html#216">source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/borrow.rs.html#217">source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.80.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#765">source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.80.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="toggle method-toggle" open><summary><section id="method.from-1" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#768">source</a><a href="#method.from-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#748-750">source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#758">source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html#tymethod.into" class="fn">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.80.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ToOwned-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/alloc/borrow.rs.html#83-85">source</a><a href="#impl-ToOwned-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl"><a href="#associatedtype.Owned" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/alloc/borrow.rs.html#88">source</a><a href="#method.to_owned" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fn">to_owned</a>(&amp;self) -&gt; T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/alloc/borrow.rs.html#92">source</a><a href="#method.clone_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fn">clone_into</a>(&amp;self, target: <a class="primitive" href="https://doc.rust-lang.org/1.80.0/std/primitive.reference.html">&amp;mut T</a>)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/1.80.0/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ToString-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/alloc/string.rs.html#2552">source</a><a href="#impl-ToString-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.80.0/alloc/string/trait.ToString.html" title="trait alloc::string::ToString">ToString</a> for T<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.80.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.to_string" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/alloc/string.rs.html#2558">source</a><a href="#method.to_string" class="anchor">§</a><h4 class="code-header">default fn <a href="https://doc.rust-lang.org/1.80.0/alloc/string/trait.ToString.html#tymethod.to_string" class="fn">to_string</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.80.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class='docblock'>Converts the given value to a <code>String</code>. <a href="https://doc.rust-lang.org/1.80.0/alloc/string/trait.ToString.html#tymethod.to_string">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#805-807">source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.80.0/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#812">source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.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.80.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.80.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#790-792">source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.80.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.80.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.80.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.80.0/src/core/convert/mod.rs.html#797">source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.80.0/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.80.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.80.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.80.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main></body></html>