edlang/clap_builder/builder/struct.Arg.html
2024-02-13 06:38:44 +00:00

2100 lines
264 KiB
HTML
Raw 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::builder - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-ac92e1bbe349e143.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="clap_builder" data-themes="" data-resource-suffix="" data-rustdoc-version="1.76.0 (07dca489a 2024-02-04)" data-channel="1.76.0" data-search-js="search-2b6ce74ff89ae146.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-f2adc0d6ca4d09fb.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-305769736d49e732.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-feafe1bb7466e4bd.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-16x16-8b506e7a72182f1c.png"><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">&#9776;</button><a class="logo-container" href="../../clap_builder/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_builder/index.html"><img src="https://raw.githubusercontent.com/clap-rs/clap/master/assets/clap.png" alt="logo"></a><h2><a href="../../clap_builder/index.html">clap_builder</a><span class="version">4.5.0</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_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-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::builder</a></h2></div></nav><div class="sidebar-resizer"></div>
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../clap_builder/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Struct <a href="../index.html">clap_builder</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"><img src="../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../../src/clap_builder/builder/arg.rs.html#57-89">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_builder::builder::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_builder::builder::Arg">Basic API</a></li>
<li><a href="struct.Arg.html#value-handling" title="struct clap_builder::builder::Arg">Value Handling</a></li>
<li><a href="struct.Arg.html#help-1" title="struct clap_builder::builder::Arg">Help</a></li>
<li><a href="struct.Arg.html#advanced-argument-relations" title="struct clap_builder::builder::Arg">Advanced Argument Relations</a></li>
<li><a href="struct.Arg.html#reflection" title="struct clap_builder::builder::Arg">Reflection</a></li>
</ul>
<h2 id="examples"><a href="#examples">Examples</a></h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="comment">// Using the traditional builder pattern and setting each option manually
</span><span class="kw">let </span>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-872">source</a><a href="#impl-Arg" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Arg.html" title="struct clap_builder::builder::Arg">Arg</a></h3></section></summary><div class="docblock"><h4 id="basic-api"><a href="#basic-api">Basic API</a></h4></div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#111-113">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.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../struct.Id.html" title="struct clap_builder::Id">Id</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Create a new <a href="struct.Arg.html" title="struct clap_builder::builder::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_builder::builder::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 href="#examples-1">Examples</a></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-122">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.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../struct.Id.html" title="struct clap_builder::Id">Id</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Set the identifier used for referencing this argument in the clap API.</p>
<p>See <a href="struct.Arg.html#method.new" title="associated function clap_builder::builder::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-179">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.char.html">char</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Sets the short version of the argument without the preceding <code>-</code>.</p>
<p>By default <code>V</code> and <code>h</code> are used by the auto-generated <code>version</code> and <code>help</code> arguments,
respectively. You will need to disable the auto-generated flags
(<a href="struct.Command.html#method.disable_help_flag" title="method clap_builder::builder::Command::disable_help_flag"><code>disable_help_flag</code></a>,
<a href="struct.Command.html#method.disable_version_flag" title="method clap_builder::builder::Command::disable_version_flag"><code>disable_version_flag</code></a>) and define your own.</p>
<h5 id="examples-2"><a href="#examples-2">Examples</a></h5>
<p>When calling <code>short</code>, use a single valid UTF-8 character which will allow using the
argument via a single hyphen (<code>-</code>) such as <code>-c</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-216">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.Str.html" title="struct clap_builder::builder::Str">Str</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Sets the long version of the argument without the preceding <code>--</code>.</p>
<p>By default <code>version</code> and <code>help</code> are used by the auto-generated <code>version</code> and <code>help</code>
arguments, respectively. You may use the word <code>version</code> or <code>help</code> for the long form of your
own arguments, in which case <code>clap</code> simply will not assign those to the auto-generated
<code>version</code> or <code>help</code> arguments.</p>
<p><strong>NOTE:</strong> Any leading <code>-</code> characters will be stripped</p>
<h5 id="examples-3"><a href="#examples-3">Examples</a></h5>
<p>To set <code>long</code> use a word containing valid UTF-8. If you supply a double leading
<code>--</code> such as <code>--config</code> they will be stripped. Hyphens in the middle of the word, however,
will <em>not</em> be stripped (i.e. <code>config-file</code> is allowed).</p>
<p>Setting <code>long</code> allows using the argument via a double hyphen (<code>--</code>) such as <code>--config</code></p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-246">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.Str.html" title="struct clap_builder::builder::Str">Str</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Add an alias, which functions as a hidden long flag.</p>
<p>This is more efficient, and easier than creating multiple hidden arguments as one only
needs to check for the existence of this command, and not all variants.</p>
<h5 id="examples-4"><a href="#examples-4">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-277">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.char.html">char</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Add an alias, which functions as a hidden short flag.</p>
<p>This is more efficient, and easier than creating multiple hidden arguments as one only
needs to check for the existence of this command, and not all variants.</p>
<h5 id="examples-5"><a href="#examples-5">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-306">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.76.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.76.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::builder::Str">Str</a>&gt;&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Add aliases, which function as hidden long flags.</p>
<p>This is more efficient, and easier than creating multiple hidden subcommands as one only
needs to check for the existence of this command, and not all variants.</p>
<h5 id="examples-6"><a href="#examples-6">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-337">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.76.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.76.0/std/primitive.char.html">char</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Add aliases, which functions as a hidden short flag.</p>
<p>This is more efficient, and easier than creating multiple hidden subcommands as one only
needs to check for the existence of this command, and not all variants.</p>
<h5 id="examples-7"><a href="#examples-7">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-367">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.Str.html" title="struct clap_builder::builder::Str">Str</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Add an alias, which functions as a visible long flag.</p>
<p>Like <a href="struct.Arg.html#method.alias" title="method clap_builder::builder::Arg::alias"><code>Arg::alias</code></a>, except that they are visible inside the help message.</p>
<h5 id="examples-8"><a href="#examples-8">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-397">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.char.html">char</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Add an alias, which functions as a visible short flag.</p>
<p>Like <a href="struct.Arg.html#method.short_alias" title="method clap_builder::builder::Arg::short_alias"><code>Arg::short_alias</code></a>, except that they are visible inside the help message.</p>
<h5 id="examples-9"><a href="#examples-9">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-424">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.76.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.76.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::builder::Str">Str</a>&gt;&gt;
) -&gt; Self</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_builder::builder::Arg::aliases"><code>Arg::aliases</code></a>, except that they are visible inside the help message.</p>
<h5 id="examples-10"><a href="#examples-10">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-452">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.76.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.76.0/std/primitive.char.html">char</a>&gt;
) -&gt; Self</h4></section></summary><div class="docblock"><p>Add aliases, which function as visible short flags.</p>
<p>Like <a href="struct.Arg.html#method.short_aliases" title="method clap_builder::builder::Arg::short_aliases"><code>Arg::short_aliases</code></a>, except that they are visible inside the help message.</p>
<h5 id="examples-11"><a href="#examples-11">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-511">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Specifies the index of a positional argument <strong>starting at</strong> 1.</p>
<p><strong>NOTE:</strong> The index refers to position according to <strong>other positional argument</strong>. It does
not define position in the argument list as a whole.</p>
<p><strong>NOTE:</strong> You can optionally leave off the <code>index</code> method, and the index will be
assigned in order of evaluation. Utilizing the <code>index</code> method allows for setting
indexes out of order</p>
<p><strong>NOTE:</strong> This is only meant to be used for positional arguments and shouldnt to be used
with <a href="struct.Arg.html#method.short" title="method clap_builder::builder::Arg::short"><code>Arg::short</code></a> or <a href="struct.Arg.html#method.long" title="method clap_builder::builder::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 href="#panics">Panics</a></h5>
<p><a href="struct.Command.html" title="struct clap_builder::builder::Command"><code>Command</code></a> will <a href="https://doc.rust-lang.org/1.76.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 href="#examples-12">Examples</a></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-543">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.76.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>This is a “VarArg” and everything that follows should be captured by it, as if the user had
used a <code>--</code>.</p>
<p><strong>NOTE:</strong> To start the trailing “VarArg” on unknown flags (and not just a positional
value), set <a href="struct.Arg.html#method.allow_hyphen_values" title="method clap_builder::builder::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_builder::builder::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_builder::builder::Arg::num_args"><code>Arg::num_args(..)</code></a>.</p>
<h5 id="examples-13"><a href="#examples-13">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-632">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.76.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>This arg is the last, or final, positional argument (i.e. has the highest
index) and is <em>only</em> able to be accessed via the <code>--</code> syntax (i.e. <code>$ prog args -- last_arg</code>).</p>
<p>Even, if no other arguments are left to parse, if the user omits the <code>--</code> syntax
they will receive an <a href="../error/enum.ErrorKind.html#variant.UnknownArgument" title="variant clap_builder::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_builder::builder::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_builder::builder::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_builder::builder::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_builder::builder::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_builder::builder::Arg::required"><code>Arg::required</code></a>)</p>
<h5 id="examples-14"><a href="#examples-14">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>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_builder::builder::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-698">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.76.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Specifies that the argument must be present.</p>
<p>Required by default means it is required, when no other conflicting rules or overrides have
been evaluated. Conflicting rules take precedence over being required.</p>
<p><strong>Pro tip:</strong> Flags (i.e. not positional, or arguments that take values) shouldnt be
required by default. This is because if a flag were to be required, it should simply be
implied. No additional information is required from user. Flags by their very nature are
simply boolean on/off switches. The only time a user <em>should</em> be required to use a flag
is if the operation is destructive in nature, and the user is essentially proving to you,
“Yes, I know what Im doing.”</p>
<h5 id="examples-15"><a href="#examples-15">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>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-765">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="../struct.Id.html" title="struct clap_builder::Id">Id</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Sets an argument that is required when this one is present</p>
<p>i.e. when using this argument, the following argument <em>must</em> be present.</p>
<p><strong>NOTE:</strong> <a href="struct.Arg.html#method.conflicts_with" title="method clap_builder::builder::Arg::conflicts_with">Conflicting</a> rules and <a href="struct.Arg.html#method.overrides_with" title="method clap_builder::builder::Arg::overrides_with">override</a> rules take precedence over being required</p>
<h5 id="examples-16"><a href="#examples-16">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>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_builder::builder::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_builder::builder::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-808">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.76.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>This argument must be passed alone; it conflicts with all other arguments.</p>
<h5 id="examples-17"><a href="#examples-17">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>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-852">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.76.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Specifies that an argument can be matched to all child <a href="../trait.Subcommand.html" title="trait clap_builder::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 href="#examples-18">Examples</a></h5>
<p>Assume an application with two subcommands, and youd like to define a
<code>--verbose</code> flag that can be called on any of the subcommands and parent, but you dont
want to clutter the source with three duplicate <a href="struct.Arg.html" title="struct clap_builder::builder::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-2057">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_builder::builder::Arg">Arg</a></h3></section></summary><div class="docblock"><h4 id="value-handling"><a href="#value-handling">Value Handling</a></h4></div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.action" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#907-910">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="enum" href="enum.ArgAction.html" title="enum clap_builder::builder::ArgAction">ArgAction</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Specify how to react to an argument when parsing it.</p>
<p><a href="enum.ArgAction.html" title="enum clap_builder::builder::ArgAction">ArgAction</a> controls things like</p>
<ul>
<li>Overwriting previous values with new ones</li>
<li>Appending new values to all previous ones</li>
<li>Counting how many times a flag occurs</li>
</ul>
<p>The default action is <code>ArgAction::Set</code></p>
<h5 id="examples-19"><a href="#examples-19">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-972">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.ValueParser.html" title="struct clap_builder::builder::ValueParser">ValueParser</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Specify the typed behavior of the argument.</p>
<p>This allows parsing and validating a value before storing it into
<a href="../parser/struct.ArgMatches.html" title="struct clap_builder::parser::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_builder::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.76.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::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::builder::PossibleValuesParser"><code>PossibleValuesParser</code></a> for static enumerated values</li>
<li><a href="struct.BoolishValueParser.html" title="struct clap_builder::builder::BoolishValueParser"><code>BoolishValueParser</code></a>, and <a href="struct.FalseyValueParser.html" title="struct clap_builder::builder::FalseyValueParser"><code>FalseyValueParser</code></a> for alternative <code>bool</code> implementations</li>
<li><a href="struct.NonEmptyStringValueParser.html" title="struct clap_builder::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::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::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-1129">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.ValueRange.html" title="struct clap_builder::builder::ValueRange">ValueRange</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Specifies the number of arguments parsed per occurrence</p>
<p>For example, if you had a <code>-f &lt;file&gt;</code> argument where you wanted exactly 3 files you would
set <code>.num_args(3)</code>, and this argument wouldnt be satisfied unless the user
provided 3 and only 3 values.</p>
<p>Users may specify values for arguments in any of the following methods</p>
<ul>
<li>Using a space such as <code>-o value</code> or <code>--option value</code></li>
<li>Using an equals and no space such as <code>-o=value</code> or <code>--option=value</code></li>
<li>Use a short and no space such as <code>-ovalue</code></li>
</ul>
<p><strong>WARNING:</strong></p>
<p>Setting a variable number of values (e.g. <code>1..=10</code>) for an argument without
other details can be dangerous in some circumstances. Because multiple values are
allowed, <code>--option val1 val2 val3</code> is perfectly valid. Be careful when designing a CLI
where <strong>positional arguments</strong> or <strong>subcommands</strong> are <em>also</em> expected as <code>clap</code> will continue
parsing <em>values</em> until one of the following happens:</p>
<ul>
<li>It reaches the maximum number of values</li>
<li>It reaches a specific number of values</li>
<li>It finds another flag or option (i.e. something that starts with a <code>-</code>)</li>
<li>It reaches the <a href="struct.Arg.html#method.value_terminator" title="method clap_builder::builder::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_builder::builder::Arg::value_delimiter">Arg::value_delimiter</a></li>
<li>Require a flag occurrence per value with <a href="enum.ArgAction.html#variant.Append" title="variant clap_builder::builder::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_builder::builder::Arg::last"><code>Arg::last</code></a></li>
</ul>
<h5 id="examples-20"><a href="#examples-20">Examples</a></h5>
<p>Option:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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_builder::builder::Arg::default_missing_value">default_missing_value</a>)</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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_builder::builder::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-1197">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.Str.html" title="struct clap_builder::builder::Str">Str</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Placeholder for the arguments value in the help message / usage.</p>
<p>This name is cosmetic only; the name is <strong>not</strong> used to access arguments.
This setting can be very helpful when describing the type of input the user should be
using, such as <code>FILE</code>, <code>INTERFACE</code>, etc. Although not required, its somewhat convention to
use all capital letters for the value name.</p>
<p><strong>NOTE:</strong> implicitly sets <a href="struct.Arg.html#method.action" title="method clap_builder::builder::Arg::action"><code>Arg::action(ArgAction::Set)</code></a></p>
<h5 id="examples-21"><a href="#examples-21">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>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-1259">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.76.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.76.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::builder::Str">Str</a>&gt;&gt;
) -&gt; Self</h4></section></summary><div class="docblock"><p>Placeholders for the arguments values in the help message / usage.</p>
<p>These names are cosmetic only, used for help and usage strings only. The names are <strong>not</strong>
used to access arguments. The values of the arguments are accessed in numeric order (i.e.
if you specify two names <code>one</code> and <code>two</code> <code>one</code> will be the first matched value, <code>two</code> will
be the second).</p>
<p>This setting can be very helpful when describing the type of input the user should be
using, such as <code>FILE</code>, <code>INTERFACE</code>, etc. Although not required, its somewhat convention to
use all capital letters for the value name.</p>
<p><strong>Pro Tip:</strong> It may help to use <a href="struct.Arg.html#method.next_line_help" title="method clap_builder::builder::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_builder::builder::Arg::action"><code>Arg::action(ArgAction::Set)</code></a> and <a href="struct.Arg.html#method.num_args" title="method clap_builder::builder::Arg::num_args"><code>Arg::num_args(1..)</code></a>.</p>
<h5 id="examples-22"><a href="#examples-22">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>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-1296">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="enum" href="enum.ValueHint.html" title="enum clap_builder::builder::ValueHint">ValueHint</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Provide the shell a hint about how to complete this argument.</p>
<p>See <a href="enum.ValueHint.html" title="enum clap_builder::builder::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-1356">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.76.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Match values against <a href="struct.PossibleValuesParser.html" title="struct clap_builder::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_builder::builder::Arg::required_if_eq"><code>Arg::required_if_eq</code></a>, <a href="struct.Arg.html#method.required_if_eq_any" title="method clap_builder::builder::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_builder::builder::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_builder::builder::Arg::num_args">taking values</a></p>
<p><strong>NOTE:</strong> To do unicode case folding, enable the <code>unicode</code> feature flag.</p>
<h5 id="examples-23"><a href="#examples-23">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-1420">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.76.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Allows values which start with a leading hyphen (<code>-</code>)</p>
<p>To limit values to just numbers, see
<a href="struct.Arg.html#method.allow_negative_numbers" title="method clap_builder::builder::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_builder::builder::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_builder::builder::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_builder::builder::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_builder::builder::Arg::num_args"><code>Arg::num_args</code></a>, as this becomes ambiguous <code>$ prog --arg -- -- val</code>. All
three <code>--, --, val</code> will be values when the user may have thought the second <code>--</code> would
constitute the normal, “Only positional args follow” idiom.</p>
<h5 id="examples-24"><a href="#examples-24">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-1450">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.76.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Allows negative numbers to pass as values.</p>
<p>This is similar to <a href="struct.Arg.html#method.allow_hyphen_values" title="method clap_builder::builder::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_builder::builder::Arg::num_args">taking values</a></p>
<h5 id="examples-25"><a href="#examples-25">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-1504">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.76.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Requires that options use the <code>--option=val</code> syntax</p>
<p>i.e. an equals between the option and associated value.</p>
<p><strong>NOTE:</strong> Setting this requires <a href="struct.Arg.html#method.num_args" title="method clap_builder::builder::Arg::num_args">taking values</a></p>
<h5 id="examples-26"><a href="#examples-26">Examples</a></h5>
<p>Setting <code>require_equals</code> requires that the option have an equals sign between
it and the associated value.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-1551">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.char.html">char</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Allow grouping of multiple values via a delimiter.</p>
<p>i.e. should <code>--option=val1,val2,val3</code> be parsed as three values (<code>val1</code>, <code>val2</code>,
and <code>val3</code>) or as a single value (<code>val1,val2,val3</code>). Defaults to using <code>,</code> (comma) as the
value delimiter for all arguments that accept values (options and positional arguments)</p>
<p><strong>NOTE:</strong> implicitly sets <a href="struct.Arg.html#method.action" title="method clap_builder::builder::Arg::action"><code>Arg::action(ArgAction::Set)</code></a></p>
<h5 id="examples-27"><a href="#examples-27">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-1606">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.Str.html" title="struct clap_builder::builder::Str">Str</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Sentinel to <strong>stop</strong> parsing multiple values of a given argument.</p>
<p>By default when
one sets <a href="struct.Arg.html#method.num_args" title="method clap_builder::builder::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_builder::builder::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_builder::builder::Arg::action">options</a> and <a href="struct.Arg.html#method.index" title="method clap_builder::builder::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 href="#examples-28">Examples</a></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-1637">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.76.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Consume all following arguments.</p>
<p>Do not be parse them individually, but rather pass them in entirety.</p>
<p>It is worth noting that setting this requires all values to come after a <code>--</code> to indicate
they should all be captured. For example:</p>
<div class="example-wrap"><pre class="language-text"><code>--foo something -- -v -v -v -b -b -b --baz -q -u -x
</code></pre></div>
<p>Will result in everything after <code>--</code> to be considered one raw argument. This behavior
may not be exactly what you are expecting and using <a href="struct.Arg.html#method.trailing_var_arg" title="method clap_builder::builder::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_builder::builder::Arg::action"><code>Arg::action(ArgAction::Set)</code></a> <a href="struct.Arg.html#method.num_args" title="method clap_builder::builder::Arg::num_args"><code>Arg::num_args(1..)</code></a>,
<a href="struct.Arg.html#method.allow_hyphen_values" title="method clap_builder::builder::Arg::allow_hyphen_values"><code>Arg::allow_hyphen_values(true)</code></a>, and <a href="struct.Arg.html#method.last" title="method clap_builder::builder::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-1704">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.OsStr.html" title="struct clap_builder::builder::OsStr">OsStr</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Value for the argument when not present.</p>
<p><strong>NOTE:</strong> If the user <em>does not</em> use this argument at runtime <a href="../parser/struct.ArgMatches.html#method.contains_id" title="method clap_builder::parser::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="../parser/struct.ArgMatches.html#method.value_source" title="method clap_builder::parser::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_builder::builder::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_builder::builder::Arg::value_delimiter"><code>Arg::value_delimiter</code></a>.</p>
<h5 id="examples-29"><a href="#examples-29">Examples</a></h5>
<p>First we use the default value without providing any value at runtime.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-1727">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.76.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.76.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::builder::OsStr">OsStr</a>&gt;&gt;
) -&gt; Self</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_builder::builder::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-1842">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.OsStr.html" title="struct clap_builder::builder::OsStr">OsStr</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Value for the argument when the flag is present but no value is specified.</p>
<p>This configuration option is often used to give the user a shortcut and allow them to
efficiently specify an option argument without requiring an explicitly value. The <code>--color</code>
argument is a common example. By, supplying an default, such as <code>default_missing_value(&quot;always&quot;)</code>,
the user can quickly just add <code>--color</code> to the command line to produce the desired color output.</p>
<p><strong>NOTE:</strong> using this configuration option requires the use of the
<a href="struct.Arg.html#method.num_args" title="method clap_builder::builder::Arg::num_args"><code>.num_args(0..N)</code></a> and the
<a href="struct.Arg.html#method.require_equals" title="method clap_builder::builder::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_builder::builder::Arg::value_delimiter"><code>Arg::value_delimiter</code></a>.</p>
<h5 id="examples-30"><a href="#examples-30">Examples</a></h5>
<p>For POSIX style <code>--color</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>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-1854">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.76.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::builder::OsStr">OsStr</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Value for the argument when the flag is present but no value is specified.</p>
<p>See <a href="struct.Arg.html#method.default_missing_value" title="method clap_builder::builder::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-1865">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.76.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.76.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::builder::OsStr">OsStr</a>&gt;&gt;
) -&gt; Self</h4></section></summary><div class="docblock"><p>Value for the argument when the flag is present but no value is specified.</p>
<p>See <a href="struct.Arg.html#method.default_missing_value" title="method clap_builder::builder::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-1881">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.76.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.76.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::builder::OsStr">OsStr</a>&gt;&gt;
) -&gt; Self</h4></section></summary><div class="docblock"><p>Value for the argument when the flag is present but no value is specified.</p>
<p>See <a href="struct.Arg.html#method.default_missing_values" title="method clap_builder::builder::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-2639">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_builder::builder::Arg">Arg</a></h3></section></summary><div class="docblock"><h4 id="help-1"><a href="#help-1">Help</a></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-2110">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.StyledStr.html" title="struct clap_builder::builder::StyledStr">StyledStr</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Sets the description of the argument for short help (<code>-h</code>).</p>
<p>Typically, this is a short (one line) description of the arg.</p>
<p>If <a href="struct.Arg.html#method.long_help" title="method clap_builder::builder::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 href="#examples-31">Examples</a></h5>
<p>Any valid UTF-8 is allowed in the help text. The one exception is when one wishes to
include a newline in the help text and have the following text be properly aligned with all
the other help text.</p>
<p>Setting <code>help</code> displays a short message to the side of the argument when the user passes
<code>-h</code> or <code>--help</code> (by default).</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-2174">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.StyledStr.html" title="struct clap_builder::builder::StyledStr">StyledStr</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Sets the description of the argument for long help (<code>--help</code>).</p>
<p>Typically this a more detailed (multi-line) message
that describes the arg.</p>
<p>If <a href="struct.Arg.html#method.help" title="method clap_builder::builder::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_builder::builder::Arg::help"><code>Arg::help</code></a> is used in completion script generation in order to be concise</p>
<h5 id="examples-32"><a href="#examples-32">Examples</a></h5>
<p>Any valid UTF-8 is allowed in the help text. The one exception is when one wishes to
include a newline in the help text and have the following text be properly aligned with all
the other help text.</p>
<p>Setting <code>help</code> displays a short message to the side of the argument when the user passes
<code>-h</code> or <code>--help</code> (by default).</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-2241">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.usize.html">usize</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Allows custom ordering of args within the help message.</p>
<p><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_builder::builder::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_builder::builder::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_builder::builder::Arg::index">positional arguments</a> which are always displayed in
<a href="struct.Arg.html#method.index" title="method clap_builder::builder::Arg::index">index</a> order.</p>
<h5 id="examples-33"><a href="#examples-33">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-2251">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.Str.html" title="struct clap_builder::builder::Str">Str</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Override the <a href="struct.Command.html#method.next_help_heading" title="method clap_builder::builder::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-2306">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.76.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Render the <a href="struct.Arg.html#method.help" title="method clap_builder::builder::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_builder::builder::Command::next_line_help"><code>crate::Command::next_line_help</code></a></p>
<h5 id="examples-34"><a href="#examples-34">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-2350">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.76.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Do not display the argument in help message.</p>
<p><strong>NOTE:</strong> This does <strong>not</strong> hide the argument from usage strings on error</p>
<h5 id="examples-35"><a href="#examples-35">Examples</a></h5>
<p>Setting <code>Hidden</code> will hide the argument when displaying help text</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-2384">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.76.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Do not display the <a href="struct.ValueParser.html#method.possible_values" title="method clap_builder::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_builder::builder::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_builder::builder::Command::hide_possible_values"><code>Command::hide_possible_values</code></a>.</p>
<h5 id="examples-36"><a href="#examples-36">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-2416">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.76.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Do not display the default value of the argument in the help message.</p>
<p>This is useful when default behavior of an arg is explained elsewhere in the help text.</p>
<p><strong>NOTE:</strong> Setting this requires <a href="struct.Arg.html#method.num_args" title="method clap_builder::builder::Arg::num_args">taking values</a></p>
<h5 id="examples-37"><a href="#examples-37">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-2561">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.76.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Hides an argument from short help (<code>-h</code>).</p>
<p><strong>NOTE:</strong> This does <strong>not</strong> hide the argument from usage strings on error</p>
<p><strong>NOTE:</strong> Setting this option will cause next-line-help output style to be used
when long help (<code>--help</code>) is called.</p>
<h5 id="examples-38"><a href="#examples-38">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>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-2638">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.76.0/std/primitive.bool.html">bool</a>) -&gt; Self</h4></section></summary><div class="docblock"><p>Hides an argument from long help (<code>--help</code>).</p>
<p><strong>NOTE:</strong> This does <strong>not</strong> hide the argument from usage strings on error</p>
<p><strong>NOTE:</strong> Setting this option will cause next-line-help output style to be used
when long help (<code>--help</code>) is called.</p>
<h5 id="examples-39"><a href="#examples-39">Examples</a></h5>
<p>Setting <code>hide_long_help(true)</code> will hide the argument when displaying long help text</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-3825">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_builder::builder::Arg">Arg</a></h3></section></summary><div class="docblock"><h4 id="advanced-argument-relations"><a href="#advanced-argument-relations">Advanced Argument Relations</a></h4></div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.group" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#2680-2687">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="../struct.Id.html" title="struct clap_builder::Id">Id</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>The name of the <a href="struct.ArgGroup.html" title="struct clap_builder::builder::ArgGroup"><code>ArgGroup</code></a> the argument belongs to.</p>
<h5 id="examples-40"><a href="#examples-40">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>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-2730">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.76.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.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../struct.Id.html" title="struct clap_builder::Id">Id</a>&gt;&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>The names of <a href="struct.ArgGroup.html" title="struct clap_builder::builder::ArgGroup"><code>ArgGroup</code></a>s the argument belongs to.</p>
<h5 id="examples-41"><a href="#examples-41">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>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-2860">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.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../struct.Id.html" title="struct clap_builder::Id">Id</a>&gt;,
predicate: impl <a class="trait" href="https://doc.rust-lang.org/1.76.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::builder::ArgPredicate">ArgPredicate</a>&gt;,
default: impl <a class="trait" href="trait.IntoResettable.html" title="trait clap_builder::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.OsStr.html" title="struct clap_builder::builder::OsStr">OsStr</a>&gt;
) -&gt; Self</h4></section></summary><div class="docblock"><p>Specifies the value of the argument if <code>arg</code> has been used at runtime.</p>
<p>If <code>default</code> is set to <code>None</code>, <code>default_value</code> will be removed.</p>
<p><strong>NOTE:</strong> This setting is perfectly compatible with <a href="struct.Arg.html#method.default_value" title="method clap_builder::builder::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_builder::builder::Arg::value_delimiter"><code>Arg::value_delimiter</code></a>.</p>
<h5 id="examples-42"><a href="#examples-42">Examples</a></h5>
<p>First we use the default value only if another arg is present at runtime.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-2978">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.76.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.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../struct.Id.html" title="struct clap_builder::Id">Id</a>&gt;, impl <a class="trait" href="https://doc.rust-lang.org/1.76.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::builder::ArgPredicate">ArgPredicate</a>&gt;, impl <a class="trait" href="trait.IntoResettable.html" title="trait clap_builder::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="struct.OsStr.html" title="struct clap_builder::builder::OsStr">OsStr</a>&gt;)&gt;
) -&gt; Self</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_builder::builder::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_builder::builder::Arg::value_delimiter"><code>Arg::value_delimiter</code></a>.</p>
<h5 id="examples-43"><a href="#examples-43">Examples</a></h5>
<p>First we use the default value only if another arg is present at runtime.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-3063">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="../struct.Id.html" title="struct clap_builder::Id">Id</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Set this arg as <a href="struct.Arg.html#method.required" title="method clap_builder::builder::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_builder::builder::Arg::required"><code>Arg::required</code></a> and is therefore not
mandatory to also set.</p>
<h5 id="examples-44"><a href="#examples-44">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>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-3142">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.76.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.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../struct.Id.html" title="struct clap_builder::Id">Id</a>&gt;&gt;
) -&gt; Self</h4></section></summary><div class="docblock"><p>Sets this arg as <a href="struct.Arg.html#method.required" title="method clap_builder::builder::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_builder::builder::Arg::required_unless_present_any"><code>Arg::required_unless_present_any</code></a></p>
<h5 id="examples-45"><a href="#examples-45">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>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_builder::builder::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-3223">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.76.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.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../struct.Id.html" title="struct clap_builder::Id">Id</a>&gt;&gt;
) -&gt; Self</h4></section></summary><div class="docblock"><p>Sets this arg as <a href="struct.Arg.html#method.required" title="method clap_builder::builder::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_builder::builder::Arg::required_unless_present_all"><code>Arg::required_unless_present_all</code></a></p>
<h5 id="examples-46"><a href="#examples-46">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>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_builder::builder::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_builder::builder::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-3310">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.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../struct.Id.html" title="struct clap_builder::Id">Id</a>&gt;,
val: impl <a class="trait" href="https://doc.rust-lang.org/1.76.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::builder::OsStr">OsStr</a>&gt;
) -&gt; Self</h4></section></summary><div class="docblock"><p>This argument is <a href="struct.Arg.html#method.required" title="method clap_builder::builder::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 href="#examples-47">Examples</a></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-3396">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.76.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.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../struct.Id.html" title="struct clap_builder::Id">Id</a>&gt;, impl <a class="trait" href="https://doc.rust-lang.org/1.76.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::builder::OsStr">OsStr</a>&gt;)&gt;
) -&gt; Self</h4></section></summary><div class="docblock"><p>Specify this argument is <a href="struct.Arg.html#method.required" title="method clap_builder::builder::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 href="#examples-48">Examples</a></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-3480">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.76.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.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../struct.Id.html" title="struct clap_builder::Id">Id</a>&gt;, impl <a class="trait" href="https://doc.rust-lang.org/1.76.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::builder::OsStr">OsStr</a>&gt;)&gt;
) -&gt; Self</h4></section></summary><div class="docblock"><p>Specify this argument is <a href="struct.Arg.html#method.required" title="method clap_builder::builder::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 href="#examples-49">Examples</a></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-3544">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.76.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::builder::ArgPredicate">ArgPredicate</a>&gt;,
arg_id: impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../struct.Id.html" title="struct clap_builder::Id">Id</a>&gt;
) -&gt; Self</h4></section></summary><div class="docblock"><p>Require another argument if this arg matches the <a href="enum.ArgPredicate.html" title="enum clap_builder::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::builder::ArgPredicate"><code>ArgPredicate</code></a>.
If it does, <code>another_arg</code> will be marked as required.</p>
<h5 id="examples-50"><a href="#examples-50">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>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-3627">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.76.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.76.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::builder::ArgPredicate">ArgPredicate</a>&gt;, impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../struct.Id.html" title="struct clap_builder::Id">Id</a>&gt;)&gt;
) -&gt; Self</h4></section></summary><div class="docblock"><p>Allows multiple conditional requirements.</p>
<p>The requirement will only become valid if this args value matches the
<a href="enum.ArgPredicate.html" title="enum clap_builder::builder::ArgPredicate"><code>ArgPredicate</code></a>.</p>
<h5 id="examples-51"><a href="#examples-51">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>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::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-3694">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="../struct.Id.html" title="struct clap_builder::Id">Id</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>This argument is mutually exclusive with the specified argument.</p>
<p><strong>NOTE:</strong> Conflicting rules take precedence over being required by default. Conflict rules
only need to be set for one of the two arguments, they do not need to be set for each.</p>
<p><strong>NOTE:</strong> Defining a conflict is two-way, but does <em>not</em> need to defined for both arguments
(i.e. if A conflicts with B, defining A.conflicts_with(B) is sufficient. You do not
need to also do B.conflicts_with(A))</p>
<p><strong>NOTE:</strong> <a href="struct.Arg.html#method.conflicts_with_all" title="method clap_builder::builder::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_builder::builder::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 href="#examples-52">Examples</a></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-3746">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.76.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.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../struct.Id.html" title="struct clap_builder::Id">Id</a>&gt;&gt;
) -&gt; Self</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_builder::builder::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 A.conflicts_with(B) is sufficient. You do not need
need to also do B.conflicts_with(A))</p>
<p><strong>NOTE:</strong> <a href="struct.Arg.html#method.exclusive" title="method clap_builder::builder::Arg::exclusive"><code>Arg::exclusive(true)</code></a> allows specifying an argument which conflicts with every other argument.</p>
<h5 id="examples-53"><a href="#examples-53">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>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-3787">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::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="../struct.Id.html" title="struct clap_builder::Id">Id</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Sets an overridable argument.</p>
<p>i.e. this argument and the following argument
will override each other in POSIX style (whichever argument was specified at runtime
<strong>last</strong> “wins”)</p>
<p><strong>NOTE:</strong> When an argument is overridden it is essentially as if it never was used, any
conflicts, requirements, etc. are evaluated <strong>after</strong> all “overrides” have been removed</p>
<p><strong>NOTE:</strong> Overriding an argument implies they <a href="struct.Arg.html#method.conflicts_with" title="method clap_builder::builder::Arg::conflicts_with">conflict</a>.</p>
<h5 id="examples-54"><a href="#examples-54">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-3824">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.76.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.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../struct.Id.html" title="struct clap_builder::Id">Id</a>&gt;&gt;
) -&gt; Self</h4></section></summary><div class="docblock"><p>Sets multiple mutually overridable arguments by name.</p>
<p>i.e. this argument and the following argument will override each other in POSIX style
(whichever argument was specified at runtime <strong>last</strong> “wins”)</p>
<p><strong>NOTE:</strong> When an argument is overridden it is essentially as if it never was used, any
conflicts, requirements, etc. are evaluated <strong>after</strong> all “overrides” have been removed</p>
<p><strong>NOTE:</strong> Overriding an argument implies they <a href="struct.Arg.html#method.conflicts_with_all" title="method clap_builder::builder::Arg::conflicts_with_all">conflict</a>.</p>
<h5 id="examples-55"><a href="#examples-55">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-4198">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_builder::builder::Arg">Arg</a></h3></section></summary><div class="docblock"><h4 id="reflection"><a href="#reflection">Reflection</a></h4></div><div class="impl-items"><details class="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-3833">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_builder::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-3839">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.76.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::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-3855">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.76.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::builder::StyledStr">StyledStr</a>&gt;</h4></section></summary><div class="docblock"><p>Get the long help specified for this argument, if any</p>
<h5 id="examples-56"><a href="#examples-56">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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-3864">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.76.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.76.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-3870">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.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.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-3886">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.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.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-3896">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.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.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-3909">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.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.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-3915">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.76.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.76.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-3930">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.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.76.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.76.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-3940">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.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.76.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.76.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-3953">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.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.76.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.76.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_possible_values" class="method"><a class="src rightside" href="../../src/clap_builder/builder/arg.rs.html#3957-3966">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.76.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::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#3970-3976">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.76.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::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#3980-3982">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.76.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::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#3991-3993">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.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.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#3998-4000">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.76.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::builder::Str">Str</a>&gt;</h4></section></summary><div class="docblock"><p>Get the value terminator for this argument. The value_terminator 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#4004-4006">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.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.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#4009-4022">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_builder::builder::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#4050-4052">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::builder::OsStr">OsStr</a>]</h4></section></summary><div class="docblock"><p>Get the default values specified for this argument, if any</p>
<h5 id="examples-57"><a href="#examples-57">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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#4067-4069">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.76.0/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Checks whether this argument is a positional or not.</p>
<h5 id="examples-58"><a href="#examples-58">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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#4072-4074">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.76.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_builder::builder::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#4087-4089">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.76.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_builder::builder::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#4092-4094">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.76.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_builder::builder::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#4097-4100">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_builder::builder::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#4118-4125">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::builder::ValueParser">ValueParser</a></h4></section></summary><div class="docblock"><p>Configured parser for argument values</p>
<h5 id="example"><a href="#example">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>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#4128-4130">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.76.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_builder::builder::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#4133-4135">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.76.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_builder::builder::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#4138-4140">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.76.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_builder::builder::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#4143-4145">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.76.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_builder::builder::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#4148-4150">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.76.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_builder::builder::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#4165-4167">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.76.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_builder::builder::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#4170-4172">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.76.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_builder::builder::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#4175-4177">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.76.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_builder::builder::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#4180-4182">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.76.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_builder::builder::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#4185-4187">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.76.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_builder::builder::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#4190-4192">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.76.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_builder::builder::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#4195-4197">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.76.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_builder::builder::Arg::ignore_case"><code>Arg::ignore_case</code></a> is set</p>
</div></details></div></details></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.76.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.Arg.html" title="struct clap_builder::builder::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.76.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_builder::builder::Arg">Arg</a></h4></section></summary><div class='docblock'>Returns a copy of the value. <a href="https://doc.rust-lang.org/1.76.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.76.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.76.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.76.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.76.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#4441-4482">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.76.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Arg.html" title="struct clap_builder::builder::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#4442-4481">source</a><a href="#method.fmt-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.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.76.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.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.76.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.76.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.76.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.Arg.html" title="struct clap_builder::builder::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.76.0/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -&gt; <a class="struct" href="struct.Arg.html" title="struct clap_builder::builder::Arg">Arg</a></h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.76.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#4434-4439">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.76.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="struct" href="struct.Arg.html" title="struct clap_builder::builder::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#4435-4438">source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.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.76.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.76.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.76.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#4408-4412">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.76.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_builder::builder::Arg">Arg</a>&gt; for <a class="struct" href="struct.Arg.html" title="struct clap_builder::builder::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#4409-4411">source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(a: &amp;<a class="struct" href="struct.Arg.html" title="struct clap_builder::builder::Arg">Arg</a>) -&gt; Self</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#4426-4430">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.76.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> for <a class="struct" href="struct.Arg.html" title="struct clap_builder::builder::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#4427-4429">source</a><a href="#method.cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.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_builder::builder::Arg">Arg</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.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.76.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.76.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.76.0/src/core/cmp.rs.html#829-831">source</a></span><a href="#method.max" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.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.76.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.76.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.76.0/src/core/cmp.rs.html#849-851">source</a></span><a href="#method.min" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.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.76.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.76.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.76.0/src/core/cmp.rs.html#874-877">source</a></span><a href="#method.clamp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.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.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.76.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.76.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#4414-4418">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.76.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a> for <a class="struct" href="struct.Arg.html" title="struct clap_builder::builder::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#4415-4417">source</a><a href="#method.eq" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.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_builder::builder::Arg">Arg</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.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.76.0/src/core/cmp.rs.html#242">source</a></span><a href="#method.ne" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.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.76.0/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.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#4420-4424">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.76.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a> for <a class="struct" href="struct.Arg.html" title="struct clap_builder::builder::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#4421-4423">source</a><a href="#method.partial_cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&amp;Self</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.76.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.76.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.76.0/src/core/cmp.rs.html#1125">source</a></span><a href="#method.lt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.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.76.0/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.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.76.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.76.0/src/core/cmp.rs.html#1142">source</a></span><a href="#method.le" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.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.76.0/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.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.76.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.76.0/src/core/cmp.rs.html#1158">source</a></span><a href="#method.gt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.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.76.0/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.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.76.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.76.0/src/core/cmp.rs.html#1175">source</a></span><a href="#method.ge" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.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.76.0/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.76.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.76.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#4432">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.76.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="struct.Arg.html" title="struct clap_builder::builder::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-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.76.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_builder::builder::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.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Arg.html" title="struct clap_builder::builder::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.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Arg.html" title="struct clap_builder::builder::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.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Arg.html" title="struct clap_builder::builder::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.76.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_builder::builder::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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.0/src/core/convert/mod.rs.html#763">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.76.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.76.0/src/core/convert/mod.rs.html#766">source</a><a href="#method.from-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.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.76.0/src/core/convert/mod.rs.html#747-749">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.76.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.76.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.76.0/src/core/convert/mod.rs.html#756">source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.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.76.0/src/alloc/string.rs.html#2600">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.76.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.76.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.76.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.76.0/src/alloc/string.rs.html#2606">source</a><a href="#method.to_string" class="anchor">§</a><h4 class="code-header">default fn <a href="https://doc.rust-lang.org/1.76.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.76.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.76.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.76.0/src/core/convert/mod.rs.html#803-805">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.76.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.76.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.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.76.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.76.0/src/core/convert/mod.rs.html#810">source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.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.76.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.76.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.76.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.76.0/src/core/convert/mod.rs.html#788-790">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.76.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.76.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.76.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.76.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.76.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.76.0/src/core/convert/mod.rs.html#795">source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.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.76.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.76.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.76.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>