edlang/clap/struct.Command.html

1584 lines
264 KiB
HTML
Raw Normal View History

<!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="Build a command-line interface."><title>Command in clap - 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-5bc39a1768837dd0.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="clap" data-themes="" data-resource-suffix="" data-rustdoc-version="1.77.2 (25ef9e3d8 2024-04-09)" data-channel="1.77.2" data-search-js="search-dd67cee4cfa65049.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-4c98445ec4002617.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-48f368f3872407c8.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-04d5337699b92874.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" title="show sidebar"></button><a class="logo-container" href="../clap/index.html"><img src="https://raw.githubusercontent.com/clap-rs/clap/master/assets/clap.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../clap/index.html"><img src="https://raw.githubusercontent.com/clap-rs/clap/master/assets/clap.png" alt="logo"></a><h2><a href="../clap/index.html">clap</a><span class="version">4.5.4</span></h2></div><h2 class="location"><a href="#">Command</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.about">about</a></li><li><a href="#method.after_help">after_help</a></li><li><a href="#method.after_long_help">after_long_help</a></li><li><a href="#method.alias">alias</a></li><li><a href="#method.aliases">aliases</a></li><li><a href="#method.allow_external_subcommands">allow_external_subcommands</a></li><li><a href="#method.allow_missing_positional">allow_missing_positional</a></li><li><a href="#method.arg">arg</a></li><li><a href="#method.arg_required_else_help">arg_required_else_help</a></li><li><a href="#method.args">args</a></li><li><a href="#method.args_conflicts_with_subcommands">args_conflicts_with_subcommands</a></li><li><a href="#method.args_override_self">args_override_self</a></li><li><a href="#method.author">author</a></li><li><a href="#method.before_help">before_help</a></li><li><a href="#method.before_long_help">before_long_help</a></li><li><a href="#method.bin_name">bin_name</a></li><li><a href="#method.build">build</a></li><li><a href="#method.color">color</a></li><li><a href="#method.debug_assert">debug_assert</a></li><li><a href="#method.defer">defer</a></li><li><a href="#method.disable_colored_help">disable_colored_help</a></li><li><a href="#method.disable_help_flag">disable_help_flag</a></li><li><a href="#method.disable_
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../clap/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</a>::<wbr><a class="struct" href="#">Command</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/command.rs.html#73">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 Command { <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>Build a command-line interface.</p>
<p>This includes defining arguments, subcommands, parser behavior, and help output.
Once all configuration is complete,
the <a href="struct.Command.html#method.get_matches" title="method clap::Command::get_matches"><code>Command::get_matches</code></a> family of methods starts the runtime-parsing
process. These methods then return information about the user supplied
arguments (or lack thereof).</p>
<p>When deriving a <a href="trait.Parser.html" title="trait clap::Parser"><code>Parser</code></a>, you can use
<a href="trait.CommandFactory.html#tymethod.command" title="associated function clap::CommandFactory::command"><code>CommandFactory::command</code></a> to access the
<code>Command</code>.</p>
<ul>
<li><a href="struct.Command.html#basic-api" title="struct clap::Command">Basic API</a></li>
<li><a href="struct.Command.html#application-wide-settings" title="struct clap::Command">Application-wide Settings</a></li>
<li><a href="struct.Command.html#command-specific-settings" title="struct clap::Command">Command-specific Settings</a></li>
<li><a href="struct.Command.html#subcommand-specific-settings" title="struct clap::Command">Subcommand-specific Settings</a></li>
<li><a href="struct.Command.html#reflection" title="struct clap::Command">Reflection</a></li>
</ul>
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"My Program"</span>)
.author(<span class="string">"Me, me@mail.com"</span>)
.version(<span class="string">"1.0.2"</span>)
.about(<span class="string">"Explains in brief what the program does"</span>)
.arg(
Arg::new(<span class="string">"in_file"</span>)
)
.after_help(<span class="string">"Longer explanation to appear after the options when \
displaying the help information from --help or -h"</span>)
.get_matches();
<span class="comment">// Your program logic starts here...</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-Command" class="impl"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#113">source</a><a href="#impl-Command" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h3></section></summary><div class="docblock"><h4 id="basic-api"><a class="doc-anchor" href="#basic-api">§</a>Basic API</h4></div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#130">source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>(name: impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Creates a new instance of an <code>Command</code>.</p>
<p>It is common, but not required, to use binary name as the <code>name</code>. This
name will only be displayed to the user when they request to print
version or help and usage information.</p>
<p>See also <a href="macro.command.html" title="macro clap::command"><code>command!</code></a> and <a href="crate::crate_name!"><code>crate_name!</code></a>.</p>
<h5 id="examples-1"><a class="doc-anchor" href="#examples-1">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"My Program"</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.arg" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#168">source</a><h4 class="code-header">pub fn <a href="#method.arg" class="fn">arg</a>(self, a: impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Arg.html" title="struct clap::Arg">Arg</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Adds an <a href="struct.Arg.html" title="struct clap::Arg">argument</a> to the list of valid possibilities.</p>
<h5 id="examples-2"><a class="doc-anchor" href="#examples-2">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
<span class="comment">// Adding a single "flag" argument with a short and help text, using Arg::new()
</span>.arg(
Arg::new(<span class="string">"debug"</span>)
.short(<span class="string">'d'</span>)
.help(<span class="string">"turns on debugging mode"</span>)
)
<span class="comment">// Adding a single "option" argument with a short, a long, and help text using the less
// verbose Arg::from()
</span>.arg(
<span class="macro">arg!</span>(-c --config &lt;CONFIG&gt; <span class="string">"Optionally sets a config file to use"</span>)
)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.args" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#204">source</a><h4 class="code-header">pub fn <a href="#method.args" class="fn">args</a>(self, args: impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/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.77.2/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Arg.html" title="struct clap::Arg">Arg</a>&gt;&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Adds multiple <a href="struct.Arg.html" title="struct clap::Arg">arguments</a> to the list of valid possibilities.</p>
<h5 id="examples-3"><a class="doc-anchor" href="#examples-3">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.args([
<span class="macro">arg!</span>(-d --debug <span class="string">"turns on debugging info"</span>),
Arg::new(<span class="string">"input"</span>).help(<span class="string">"the input file to use"</span>)
])</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.mut_arg" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#241-243">source</a><h4 class="code-header">pub fn <a href="#method.mut_arg" class="fn">mut_arg</a>&lt;F&gt;(self, arg_id: impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.str.html">str</a>&gt;, f: F) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a><div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="struct" href="struct.Arg.html" title="struct clap::Arg">Arg</a>) -&gt; <a class="struct" href="struct.Arg.html" title="struct clap::Arg">Arg</a>,</div></h4></section></summary><div class="docblock"><p>Allows one to mutate an <a href="struct.Arg.html" title="struct clap::Arg"><code>Arg</code></a> after its been added to a <a href="struct.Command.html" title="struct clap::Command"><code>Command</code></a>.</p>
<h5 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h5>
<p>If the argument is undefined</p>
<h5 id="examples-4"><a class="doc-anchor" href="#examples-4">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>
<span class="kw">let </span><span class="kw-2">mut </span>cmd = Command::new(<span class="string">"foo"</span>)
.arg(Arg::new(<span class="string">"bar"</span>)
.short(<span class="string">'b'</span>)
.action(ArgAction::SetTrue))
.mut_arg(<span class="string">"bar"</span>, |a| a.short(<span class="string">'B'</span>));
<span class="kw">let </span>res = cmd.try_get_matches_from_mut(<span class="macro">vec!</span>[<span class="string">"foo"</span>, <span class="string">"-b"</span>]);
<span class="comment">// Since we changed `bar`'s short to "B" this should err as there
// is no `-b` anymore, only `-B`
</span><span class="macro">assert!</span>(res.is_err());
<span class="kw">let </span>res = cmd.try_get_matches_from_mut(<span class="macro">vec!</span>[<span class="string">"foo"</span>, <span class="string">"-B"</span>]);
<span class="macro">assert!</span>(res.is_ok());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.mut_args" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#293-295">source</a><h4 class="code-header">pub fn <a href="#method.mut_args" class="fn">mut_args</a>&lt;F&gt;(self, f: F) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a><div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(<a class="struct" href="struct.Arg.html" title="struct clap::Arg">Arg</a>) -&gt; <a class="struct" href="struct.Arg.html" title="struct clap::Arg">Arg</a>,</div></h4></section></summary><div class="docblock"><p>Allows one to mutate all <a href="struct.Arg.html" title="struct clap::Arg"><code>Arg</code></a>s after theyve been added to a <a href="struct.Command.html" title="struct clap::Command"><code>Command</code></a>.</p>
<p>This does not affect the built-in <code>--help</code> or <code>--version</code> arguments.</p>
<h5 id="examples-5"><a class="doc-anchor" href="#examples-5">§</a>Examples</h5>
<div class="example-wrap ignore"><a href="#" class="tooltip" title="This example is not tested"></a><pre class="rust rust-example-rendered"><code>
<span class="kw">let </span><span class="kw-2">mut </span>cmd = Command::new(<span class="string">"foo"</span>)
.arg(Arg::new(<span class="string">"bar"</span>)
.long(<span class="string">"bar"</span>)
.action(ArgAction::SetTrue))
.arg(Arg::new(<span class="string">"baz"</span>)
.long(<span class="string">"baz"</span>)
.action(ArgAction::SetTrue))
.mut_args(|a| {
<span class="kw">if let </span><span class="prelude-val">Some</span>(l) = a.get_long().map(|l| <span class="macro">format!</span>(<span class="string">"prefix-{l}"</span>)) {
a.long(l)
} <span class="kw">else </span>{
a
}
});
<span class="kw">let </span>res = cmd.try_get_matches_from_mut(<span class="macro">vec!</span>[<span class="string">"foo"</span>, <span class="string">"--bar"</span>]);
<span class="comment">// Since we changed `bar`'s long to "prefix-bar" this should err as there
// is no `--bar` anymore, only `--prefix-bar`.
</span><span class="macro">assert!</span>(res.is_err());
<span class="kw">let </span>res = cmd.try_get_matches_from_mut(<span class="macro">vec!</span>[<span class="string">"foo"</span>, <span class="string">"--prefix-bar"</span>]);
<span class="macro">assert!</span>(res.is_ok());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.mut_group" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#325-327">source</a><h4 class="code-header">pub fn <a href="#method.mut_group" class="fn">mut_group</a>&lt;F&gt;(self, arg_id: impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.str.html">str</a>&gt;, f: F) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a><div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="struct" href="struct.ArgGroup.html" title="struct clap::ArgGroup">ArgGroup</a>) -&gt; <a class="struct" href="struct.ArgGroup.html" title="struct clap::ArgGroup">ArgGroup</a>,</div></h4></section></summary><div class="docblock"><p>Allows one to mutate an <a href="struct.ArgGroup.html" title="struct clap::ArgGroup"><code>ArgGroup</code></a> after its been added to a <a href="struct.Command.html" title="struct clap::Command"><code>Command</code></a>.</p>
<h5 id="panics-1"><a class="doc-anchor" href="#panics-1">§</a>Panics</h5>
<p>If the argument is undefined</p>
<h5 id="examples-6"><a class="doc-anchor" href="#examples-6">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>
Command::new(<span class="string">"foo"</span>)
.arg(<span class="macro">arg!</span>(--<span class="string">"set-ver" </span>&lt;ver&gt; <span class="string">"set the version manually"</span>).required(<span class="bool-val">false</span>))
.arg(<span class="macro">arg!</span>(--major <span class="string">"auto increase major"</span>))
.arg(<span class="macro">arg!</span>(--minor <span class="string">"auto increase minor"</span>))
.arg(<span class="macro">arg!</span>(--patch <span class="string">"auto increase patch"</span>))
.group(ArgGroup::new(<span class="string">"vers"</span>)
.args([<span class="string">"set-ver"</span>, <span class="string">"major"</span>, <span class="string">"minor"</span>,<span class="string">"patch"</span>])
.required(<span class="bool-val">true</span>))
.mut_group(<span class="string">"vers"</span>, |a| a.required(<span class="bool-val">false</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.mut_subcommand" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#369-371">source</a><h4 class="code-header">pub fn <a href="#method.mut_subcommand" class="fn">mut_subcommand</a>&lt;F&gt;(self, name: impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.str.html">str</a>&gt;, f: F) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a><div class="where">where
F: <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a>,</div></h4></section></summary><div class="docblock"><p>Allows one to mutate a <a href="struct.Command.html" title="struct clap::Command"><code>Command</code></a> after its been added as a subcommand.</p>
<p>This can be useful for modifying auto-generated arguments of nested subcommands with
<a href="struct.Command.html#method.mut_arg" title="method clap::Command::mut_arg"><code>Command::mut_arg</code></a>.</p>
<h5 id="panics-2"><a class="doc-anchor" href="#panics-2">§</a>Panics</h5>
<p>If the subcommand is undefined</p>
<h5 id="examples-7"><a class="doc-anchor" href="#examples-7">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>
<span class="kw">let </span><span class="kw-2">mut </span>cmd = Command::new(<span class="string">"foo"</span>)
.subcommand(Command::new(<span class="string">"bar"</span>))
.mut_subcommand(<span class="string">"bar"</span>, |subcmd| subcmd.disable_help_flag(<span class="bool-val">true</span>));
<span class="kw">let </span>res = cmd.try_get_matches_from_mut(<span class="macro">vec!</span>[<span class="string">"foo"</span>, <span class="string">"bar"</span>, <span class="string">"--help"</span>]);
<span class="comment">// Since we disabled the help flag on the "bar" subcommand, this should err.
</span><span class="macro">assert!</span>(res.is_err());
<span class="kw">let </span>res = cmd.try_get_matches_from_mut(<span class="macro">vec!</span>[<span class="string">"foo"</span>, <span class="string">"bar"</span>]);
<span class="macro">assert!</span>(res.is_ok());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.group" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#420">source</a><h4 class="code-header">pub fn <a href="#method.group" class="fn">group</a>(self, group: impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.ArgGroup.html" title="struct clap::ArgGroup">ArgGroup</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Adds an <a href="struct.ArgGroup.html" title="struct clap::ArgGroup"><code>ArgGroup</code></a> to the application.</p>
<p><a href="struct.ArgGroup.html" title="struct clap::ArgGroup"><code>ArgGroup</code></a>s are a family of related arguments.
By placing them in a logical group, you can build easier requirement and exclusion rules.</p>
<p>Example use cases:</p>
<ul>
<li>Make an entire <a href="struct.ArgGroup.html" title="struct clap::ArgGroup"><code>ArgGroup</code></a> required, meaning that one (and <em>only</em>
one) argument from that group must be present at runtime.</li>
<li>Name an <a href="struct.ArgGroup.html" title="struct clap::ArgGroup"><code>ArgGroup</code></a> as a conflict to another argument.
Meaning any of the arguments that belong to that group will cause a failure if present with
the conflicting argument.</li>
<li>Ensure exclusion between arguments.</li>
<li>Extract a value from a group instead of determining exactly which argument was used.</li>
</ul>
<h5 id="examples-8"><a class="doc-anchor" href="#examples-8">§</a>Examples</h5>
<p>The following example demonstrates using an <a href="struct.ArgGroup.html" title="struct clap::ArgGroup"><code>ArgGroup</code></a> to ensure that one, and only one,
of the arguments from the specified group is present at runtime.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"cmd"</span>)
.arg(<span class="macro">arg!</span>(--<span class="string">"set-ver" </span>&lt;ver&gt; <span class="string">"set the version manually"</span>).required(<span class="bool-val">false</span>))
.arg(<span class="macro">arg!</span>(--major <span class="string">"auto increase major"</span>))
.arg(<span class="macro">arg!</span>(--minor <span class="string">"auto increase minor"</span>))
.arg(<span class="macro">arg!</span>(--patch <span class="string">"auto increase patch"</span>))
.group(ArgGroup::new(<span class="string">"vers"</span>)
.args([<span class="string">"set-ver"</span>, <span class="string">"major"</span>, <span class="string">"minor"</span>,<span class="string">"patch"</span>])
.required(<span class="bool-val">true</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/command.rs.html#449">source</a><h4 class="code-header">pub fn <a href="#method.groups" class="fn">groups</a>(
self,
groups: impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/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.77.2/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.ArgGroup.html" title="struct clap::ArgGroup">ArgGroup</a>&gt;&gt;
) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Adds multiple <a href="struct.ArgGroup.html" title="struct clap::ArgGroup"><code>ArgGroup</code></a>s to the <a href="struct.Command.html" title="struct clap::Command"><code>Command</code></a> at once.</p>
<h5 id="examples-9"><a class="doc-anchor" href="#examples-9">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"cmd"</span>)
.arg(<span class="macro">arg!</span>(--<span class="string">"set-ver" </span>&lt;ver&gt; <span class="string">"set the version manually"</span>).required(<span class="bool-val">false</span>))
.arg(<span class="macro">arg!</span>(--major <span class="string">"auto increase major"</span>))
.arg(<span class="macro">arg!</span>(--minor <span class="string">"auto increase minor"</span>))
.arg(<span class="macro">arg!</span>(--patch <span class="string">"auto increase patch"</span>))
.arg(<span class="macro">arg!</span>(-c &lt;FILE&gt; <span class="string">"a config file"</span>).required(<span class="bool-val">false</span>))
.arg(<span class="macro">arg!</span>(-i &lt;IFACE&gt; <span class="string">"an interface"</span>).required(<span class="bool-val">false</span>))
.groups([
ArgGroup::new(<span class="string">"vers"</span>)
.args([<span class="string">"set-ver"</span>, <span class="string">"major"</span>, <span class="string">"minor"</span>,<span class="string">"patch"</span>])
.required(<span class="bool-val">true</span>),
ArgGroup::new(<span class="string">"input"</span>)
.args([<span class="string">"c"</span>, <span class="string">"i"</span>])
])</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.subcommand" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#479">source</a><h4 class="code-header">pub fn <a href="#method.subcommand" class="fn">subcommand</a>(self, subcmd: impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Adds a subcommand to the list of valid possibilities.</p>
<p>Subcommands are effectively sub-<a href="struct.Command.html" title="struct clap::Command"><code>Command</code></a>s, because they can contain their own arguments,
subcommands, version, usage, etc. They also function just like <a href="struct.Command.html" title="struct clap::Command"><code>Command</code></a>s, in that they get
their own auto generated help, version, and usage.</p>
<p>A subcommands <a href="struct.Command.html#method.name" title="method clap::Command::name"><code>Command::name</code></a> will be used for:</p>
<ul>
<li>The argument the user passes in</li>
<li>Programmatically looking up the subcommand</li>
</ul>
<h5 id="examples-10"><a class="doc-anchor" href="#examples-10">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.subcommand(Command::new(<span class="string">"config"</span>)
.about(<span class="string">"Controls configuration features"</span>)
.arg(<span class="macro">arg!</span>(&lt;config&gt; <span class="string">"Required configuration file to use"</span>)))</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.subcommands" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#510">source</a><h4 class="code-header">pub fn <a href="#method.subcommands" class="fn">subcommands</a>(
self,
subcmds: impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/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.77.2/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a>&gt;&gt;
) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Adds multiple subcommands to the list of valid possibilities.</p>
<h5 id="examples-11"><a class="doc-anchor" href="#examples-11">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>.subcommands( [
Command::new(<span class="string">"config"</span>).about(<span class="string">"Controls configuration functionality"</span>)
.arg(Arg::new(<span class="string">"config_file"</span>)),
Command::new(<span class="string">"debug"</span>).about(<span class="string">"Controls debug functionality"</span>)])</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.defer" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#536">source</a><h4 class="code-header">pub fn <a href="#method.defer" class="fn">defer</a>(self, deferred: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.fn.html">fn</a>(_: <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Delay initialization for parts of the <code>Command</code></p>
<p>This is useful for large applications to delay definitions of subcommands until they are
being invoked.</p>
<h5 id="examples-12"><a class="doc-anchor" href="#examples-12">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.subcommand(Command::new(<span class="string">"config"</span>)
.about(<span class="string">"Controls configuration features"</span>)
.defer(|cmd| {
cmd.arg(<span class="macro">arg!</span>(&lt;config&gt; <span class="string">"Required configuration file to use"</span>))
})
)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.debug_assert" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#573">source</a><h4 class="code-header">pub fn <a href="#method.debug_assert" class="fn">debug_assert</a>(self)</h4></section></summary><div class="docblock"><p>Catch problems earlier in the development cycle.</p>
<p>Most error states are handled as asserts under the assumption they are programming mistake
and not something to handle at runtime. Rather than relying on tests (manual or automated)
that exhaustively test your CLI to ensure the asserts are evaluated, this will run those
asserts in a way convenient for running as a test.</p>
<p><strong>Note::</strong> This will not help with asserts in <a href="struct.ArgMatches.html" title="struct clap::ArgMatches"><code>ArgMatches</code></a>, those will need exhaustive
testing of your CLI.</p>
<h5 id="examples-13"><a class="doc-anchor" href="#examples-13">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>cmd() -&gt; Command {
Command::new(<span class="string">"foo"</span>)
.arg(
Arg::new(<span class="string">"bar"</span>).short(<span class="string">'b'</span>).action(ArgAction::SetTrue)
)
}
<span class="attr">#[test]
</span><span class="kw">fn </span>verify_app() {
cmd().debug_assert();
}
<span class="kw">fn </span>main() {
<span class="kw">let </span>m = cmd().get_matches_from(<span class="macro">vec!</span>[<span class="string">"foo"</span>, <span class="string">"-b"</span>]);
<span class="macro">println!</span>(<span class="string">"{}"</span>, m.get_flag(<span class="string">"bar"</span>));
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.error" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#587">source</a><h4 class="code-header">pub fn <a href="#method.error" class="fn">error</a>(&amp;mut self, kind: <a class="enum" href="error/enum.ErrorKind.html" title="enum clap::error::ErrorKind">ErrorKind</a>, message: impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>) -&gt; <a class="struct" href="error/struct.Error.html" title="struct clap::error::Error">Error</a></h4></section></summary><div class="docblock"><p>Custom error message for post-parsing validation</p>
<h5 id="examples-14"><a class="doc-anchor" href="#examples-14">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>cmd = Command::new(<span class="string">"myprog"</span>);
<span class="kw">let </span>err = cmd.error(ErrorKind::InvalidValue, <span class="string">"Some failure case"</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_matches" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#609">source</a><h4 class="code-header">pub fn <a href="#method.get_matches" class="fn">get_matches</a>(self) -&gt; <a class="struct" href="struct.ArgMatches.html" title="struct clap::ArgMatches">ArgMatches</a></h4></section></summary><div class="docblock"><p>Parse <a href="https://doc.rust-lang.org/1.77.2/std/env/fn.args_os.html" title="fn std::env::args_os"><code>env::args_os</code></a>, <a href="error/struct.Error.html#method.exit" title="method clap::error::Error::exit">exiting</a> on failure.</p>
<h5 id="panics-3"><a class="doc-anchor" href="#panics-3">§</a>Panics</h5>
<p>If contradictory arguments or settings exist (debug builds).</p>
<h5 id="examples-15"><a class="doc-anchor" href="#examples-15">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>matches = Command::new(<span class="string">"myprog"</span>)
<span class="comment">// Args and options go here...
</span>.get_matches();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_matches_mut" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#633">source</a><h4 class="code-header">pub fn <a href="#method.get_matches_mut" class="fn">get_matches_mut</a>(&amp;mut self) -&gt; <a class="struct" href="struct.ArgMatches.html" title="struct clap::ArgMatches">ArgMatches</a></h4></section></summary><div class="docblock"><p>Parse <a href="https://doc.rust-lang.org/1.77.2/std/env/fn.args_os.html" title="fn std::env::args_os"><code>env::args_os</code></a>, <a href="error/struct.Error.html#method.exit" title="method clap::error::Error::exit">exiting</a> on failure.</p>
<p>Like <a href="struct.Command.html#method.get_matches" title="method clap::Command::get_matches"><code>Command::get_matches</code></a> but doesnt consume the <code>Command</code>.</p>
<h5 id="panics-4"><a class="doc-anchor" href="#panics-4">§</a>Panics</h5>
<p>If contradictory arguments or settings exist (debug builds).</p>
<h5 id="examples-16"><a class="doc-anchor" href="#examples-16">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>cmd = Command::new(<span class="string">"myprog"</span>)
<span class="comment">// Args and options go here...
</span>;
<span class="kw">let </span>matches = cmd.get_matches_mut();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_matches" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#668">source</a><h4 class="code-header">pub fn <a href="#method.try_get_matches" class="fn">try_get_matches</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.ArgMatches.html" title="struct clap::ArgMatches">ArgMatches</a>, <a class="struct" href="error/struct.Error.html" title="struct clap::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Parse <a href="https://doc.rust-lang.org/1.77.2/std/env/fn.args_os.html" title="fn std::env::args_os"><code>env::args_os</code></a>, returning a <a href="https://doc.rust-lang.org/1.77.2/core/result/enum.Result.html" title="enum core::result::Result"><code>clap::Result</code></a> on failure.</p>
<p><strong>NOTE:</strong> This method WILL NOT exit when <code>--help</code> or <code>--version</code> (or short versions) are
used. It will return a <a href="type.Error.html" title="type clap::Error"><code>clap::Error</code></a>, where the <a href="type.Error.html" title="type clap::Error"><code>kind</code></a> is a
<a href="error/enum.ErrorKind.html#variant.DisplayHelp" title="variant clap::error::ErrorKind::DisplayHelp"><code>ErrorKind::DisplayHelp</code></a> or <a href="error/enum.ErrorKind.html#variant.DisplayVersion" title="variant clap::error::ErrorKind::DisplayVersion"><code>ErrorKind::DisplayVersion</code></a> respectively. You must call
<a href="error/struct.Error.html#method.exit" title="method clap::error::Error::exit"><code>Error::exit</code></a> or perform a <a href="https://doc.rust-lang.org/1.77.2/std/process/fn.exit.html" title="fn std::process::exit"><code>std::process::exit</code></a>.</p>
<h5 id="panics-5"><a class="doc-anchor" href="#panics-5">§</a>Panics</h5>
<p>If contradictory arguments or settings exist (debug builds).</p>
<h5 id="examples-17"><a class="doc-anchor" href="#examples-17">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>matches = Command::new(<span class="string">"myprog"</span>)
<span class="comment">// Args and options go here...
</span>.try_get_matches()
.unwrap_or_else(|e| e.exit());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_matches_from" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#696-699">source</a><h4 class="code-header">pub fn <a href="#method.get_matches_from" class="fn">get_matches_from</a>&lt;I, T&gt;(self, itr: I) -&gt; <a class="struct" href="struct.ArgMatches.html" title="struct clap::ArgMatches">ArgMatches</a><div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = T&gt;,
T: <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.77.2/std/ffi/os_str/struct.OsString.html" title="struct std::ffi::os_str::OsString">OsString</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class="docblock"><p>Parse the specified arguments, <a href="error/struct.Error.html#method.exit" title="method clap::error::Error::exit">exiting</a> on failure.</p>
<p><strong>NOTE:</strong> The first argument will be parsed as the binary name unless
<a href="struct.Command.html#method.no_binary_name" title="method clap::Command::no_binary_name"><code>Command::no_binary_name</code></a> is used.</p>
<h5 id="panics-6"><a class="doc-anchor" href="#panics-6">§</a>Panics</h5>
<p>If contradictory arguments or settings exist (debug builds).</p>
<h5 id="examples-18"><a class="doc-anchor" href="#examples-18">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>arg_vec = <span class="macro">vec!</span>[<span class="string">"my_prog"</span>, <span class="string">"some"</span>, <span class="string">"args"</span>, <span class="string">"to"</span>, <span class="string">"parse"</span>];
<span class="kw">let </span>matches = Command::new(<span class="string">"myprog"</span>)
<span class="comment">// Args and options go here...
</span>.get_matches_from(arg_vec);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_matches_from" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#743-746">source</a><h4 class="code-header">pub fn <a href="#method.try_get_matches_from" class="fn">try_get_matches_from</a>&lt;I, T&gt;(self, itr: I) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.ArgMatches.html" title="struct clap::ArgMatches">ArgMatches</a>, <a class="struct" href="error/struct.Error.html" title="struct clap::error::Error">Error</a>&gt;<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = T&gt;,
T: <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.77.2/std/ffi/os_str/struct.OsString.html" title="struct std::ffi::os_str::OsString">OsString</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class="docblock"><p>Parse the specified arguments, returning a <a href="https://doc.rust-lang.org/1.77.2/core/result/enum.Result.html" title="enum core::result::Result"><code>clap::Result</code></a> on failure.</p>
<p><strong>NOTE:</strong> This method WILL NOT exit when <code>--help</code> or <code>--version</code> (or short versions) are
used. It will return a <a href="type.Error.html" title="type clap::Error"><code>clap::Error</code></a>, where the <a href="type.Error.html" title="type clap::Error"><code>kind</code></a> is a <a href="error/enum.ErrorKind.html#variant.DisplayHelp" title="variant clap::error::ErrorKind::DisplayHelp"><code>ErrorKind::DisplayHelp</code></a>
or <a href="error/enum.ErrorKind.html#variant.DisplayVersion" title="variant clap::error::ErrorKind::DisplayVersion"><code>ErrorKind::DisplayVersion</code></a> respectively. You must call <a href="error/struct.Error.html#method.exit" title="method clap::error::Error::exit"><code>Error::exit</code></a> or
perform a <a href="https://doc.rust-lang.org/1.77.2/std/process/fn.exit.html" title="fn std::process::exit"><code>std::process::exit</code></a> yourself.</p>
<p><strong>NOTE:</strong> The first argument will be parsed as the binary name unless
<a href="struct.Command.html#method.no_binary_name" title="method clap::Command::no_binary_name"><code>Command::no_binary_name</code></a> is used.</p>
<h5 id="panics-7"><a class="doc-anchor" href="#panics-7">§</a>Panics</h5>
<p>If contradictory arguments or settings exist (debug builds).</p>
<h5 id="examples-19"><a class="doc-anchor" href="#examples-19">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>arg_vec = <span class="macro">vec!</span>[<span class="string">"my_prog"</span>, <span class="string">"some"</span>, <span class="string">"args"</span>, <span class="string">"to"</span>, <span class="string">"parse"</span>];
<span class="kw">let </span>matches = Command::new(<span class="string">"myprog"</span>)
<span class="comment">// Args and options go here...
</span>.try_get_matches_from(arg_vec)
.unwrap_or_else(|e| e.exit());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.try_get_matches_from_mut" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#783-786">source</a><h4 class="code-header">pub fn <a href="#method.try_get_matches_from_mut" class="fn">try_get_matches_from_mut</a>&lt;I, T&gt;(
&amp;mut self,
itr: I
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.ArgMatches.html" title="struct clap::ArgMatches">ArgMatches</a>, <a class="struct" href="error/struct.Error.html" title="struct clap::error::Error">Error</a>&gt;<div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&lt;Item = T&gt;,
T: <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.77.2/std/ffi/os_str/struct.OsString.html" title="struct std::ffi::os_str::OsString">OsString</a>&gt; + <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h4></section></summary><div class="docblock"><p>Parse the specified arguments, returning a <a href="https://doc.rust-lang.org/1.77.2/core/result/enum.Result.html" title="enum core::result::Result"><code>clap::Result</code></a> on failure.</p>
<p>Like <a href="struct.Command.html#method.try_get_matches_from" title="method clap::Command::try_get_matches_from"><code>Command::try_get_matches_from</code></a> but doesnt consume the <code>Command</code>.</p>
<p><strong>NOTE:</strong> This method WILL NOT exit when <code>--help</code> or <code>--version</code> (or short versions) are
used. It will return a <a href="type.Error.html" title="type clap::Error"><code>clap::Error</code></a>, where the <a href="type.Error.html" title="type clap::Error"><code>kind</code></a> is a <a href="error/enum.ErrorKind.html#variant.DisplayHelp" title="variant clap::error::ErrorKind::DisplayHelp"><code>ErrorKind::DisplayHelp</code></a>
or <a href="error/enum.ErrorKind.html#variant.DisplayVersion" title="variant clap::error::ErrorKind::DisplayVersion"><code>ErrorKind::DisplayVersion</code></a> respectively. You must call <a href="error/struct.Error.html#method.exit" title="method clap::error::Error::exit"><code>Error::exit</code></a> or
perform a <a href="https://doc.rust-lang.org/1.77.2/std/process/fn.exit.html" title="fn std::process::exit"><code>std::process::exit</code></a> yourself.</p>
<p><strong>NOTE:</strong> The first argument will be parsed as the binary name unless
<a href="struct.Command.html#method.no_binary_name" title="method clap::Command::no_binary_name"><code>Command::no_binary_name</code></a> is used.</p>
<h5 id="panics-8"><a class="doc-anchor" href="#panics-8">§</a>Panics</h5>
<p>If contradictory arguments or settings exist (debug builds).</p>
<h5 id="examples-20"><a class="doc-anchor" href="#examples-20">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>arg_vec = <span class="macro">vec!</span>[<span class="string">"my_prog"</span>, <span class="string">"some"</span>, <span class="string">"args"</span>, <span class="string">"to"</span>, <span class="string">"parse"</span>];
<span class="kw">let </span><span class="kw-2">mut </span>cmd = Command::new(<span class="string">"myprog"</span>);
<span class="comment">// Args and options go here...
</span><span class="kw">let </span>matches = cmd.try_get_matches_from_mut(arg_vec)
.unwrap_or_else(|e| e.exit());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.print_help" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#846">source</a><h4 class="code-header">pub fn <a href="#method.print_help" class="fn">print_help</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.77.2/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Prints the short help message (<code>-h</code>) to <a href="https://doc.rust-lang.org/1.77.2/std/io/stdio/fn.stdout.html" title="fn std::io::stdio::stdout"><code>io::stdout()</code></a>.</p>
<p>See also <a href="struct.Command.html#method.print_long_help" title="method clap::Command::print_long_help"><code>Command::print_long_help</code></a>.</p>
<h5 id="examples-21"><a class="doc-anchor" href="#examples-21">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>cmd = Command::new(<span class="string">"myprog"</span>);
cmd.print_help();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.print_long_help" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#874">source</a><h4 class="code-header">pub fn <a href="#method.print_long_help" class="fn">print_long_help</a>(&amp;mut self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.77.2/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Prints the long help message (<code>--help</code>) to <a href="https://doc.rust-lang.org/1.77.2/std/io/stdio/fn.stdout.html" title="fn std::io::stdio::stdout"><code>io::stdout()</code></a>.</p>
<p>See also <a href="struct.Command.html#method.print_help" title="method clap::Command::print_help"><code>Command::print_help</code></a>.</p>
<h5 id="examples-22"><a class="doc-anchor" href="#examples-22">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>cmd = Command::new(<span class="string">"myprog"</span>);
cmd.print_long_help();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.render_help" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#904">source</a><h4 class="code-header">pub fn <a href="#method.render_help" class="fn">render_help</a>(&amp;mut self) -&gt; <a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a></h4></section></summary><div class="docblock"><p>Render the short help message (<code>-h</code>) to a <a href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr"><code>StyledStr</code></a></p>
<p>See also <a href="struct.Command.html#method.render_long_help" title="method clap::Command::render_long_help"><code>Command::render_long_help</code></a>.</p>
<h5 id="examples-23"><a class="doc-anchor" href="#examples-23">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::io;
<span class="kw">let </span><span class="kw-2">mut </span>cmd = Command::new(<span class="string">"myprog"</span>);
<span class="kw">let </span><span class="kw-2">mut </span>out = io::stdout();
<span class="kw">let </span>help = cmd.render_help();
<span class="macro">println!</span>(<span class="string">"{help}"</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.render_long_help" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#931">source</a><h4 class="code-header">pub fn <a href="#method.render_long_help" class="fn">render_long_help</a>(&amp;mut self) -&gt; <a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a></h4></section></summary><div class="docblock"><p>Render the long help message (<code>--help</code>) to a <a href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr"><code>StyledStr</code></a>.</p>
<p>See also <a href="struct.Command.html#method.render_help" title="method clap::Command::render_help"><code>Command::render_help</code></a>.</p>
<h5 id="examples-24"><a class="doc-anchor" href="#examples-24">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::io;
<span class="kw">let </span><span class="kw-2">mut </span>cmd = Command::new(<span class="string">"myprog"</span>);
<span class="kw">let </span><span class="kw-2">mut </span>out = io::stdout();
<span class="kw">let </span>help = cmd.render_long_help();
<span class="macro">println!</span>(<span class="string">"{help}"</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.render_version" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#991">source</a><h4 class="code-header">pub fn <a href="#method.render_version" class="fn">render_version</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.77.2/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class="docblock"><p>Version message rendered as if the user ran <code>-V</code>.</p>
<p>See also <a href="struct.Command.html#method.render_long_version" title="method clap::Command::render_long_version"><code>Command::render_long_version</code></a>.</p>
<h6 id="coloring"><a class="doc-anchor" href="#coloring">§</a>Coloring</h6>
<p>This function does not try to color the message nor it inserts any <a href="https://en.wikipedia.org/wiki/ANSI_escape_code">ANSI escape codes</a>.</p>
<h6 id="examples-25"><a class="doc-anchor" href="#examples-25">§</a>Examples</h6>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::io;
<span class="kw">let </span>cmd = Command::new(<span class="string">"myprog"</span>);
<span class="macro">println!</span>(<span class="string">"{}"</span>, cmd.render_version());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.render_long_version" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1016">source</a><h4 class="code-header">pub fn <a href="#method.render_long_version" class="fn">render_long_version</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.77.2/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class="docblock"><p>Version message rendered as if the user ran <code>--version</code>.</p>
<p>See also <a href="struct.Command.html#method.render_version" title="method clap::Command::render_version"><code>Command::render_version</code></a>.</p>
<h6 id="coloring-1"><a class="doc-anchor" href="#coloring-1">§</a>Coloring</h6>
<p>This function does not try to color the message nor it inserts any <a href="https://en.wikipedia.org/wiki/ANSI_escape_code">ANSI escape codes</a>.</p>
<h6 id="examples-26"><a class="doc-anchor" href="#examples-26">§</a>Examples</h6>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::io;
<span class="kw">let </span>cmd = Command::new(<span class="string">"myprog"</span>);
<span class="macro">println!</span>(<span class="string">"{}"</span>, cmd.render_long_version());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.render_usage" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1031">source</a><h4 class="code-header">pub fn <a href="#method.render_usage" class="fn">render_usage</a>(&amp;mut self) -&gt; <a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a></h4></section></summary><div class="docblock"><p>Usage statement</p>
<h6 id="examples-27"><a class="doc-anchor" href="#examples-27">§</a>Examples</h6>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::io;
<span class="kw">let </span><span class="kw-2">mut </span>cmd = Command::new(<span class="string">"myprog"</span>);
<span class="macro">println!</span>(<span class="string">"{}"</span>, cmd.render_usage());</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Command-1" class="impl"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1048">source</a><a href="#impl-Command-1" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h3></section></summary><div class="docblock"><h4 id="application-wide-settings"><a class="doc-anchor" href="#application-wide-settings">§</a>Application-wide Settings</h4>
<p>These settings will apply to the top-level command and all subcommands, by default. Some
settings can be overridden in subcommands.</p>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.no_binary_name" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1069">source</a><h4 class="code-header">pub fn <a href="#method.no_binary_name" class="fn">no_binary_name</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Specifies that the parser should not assume the first argument passed is the binary name.</p>
<p>This is normally the case when using a “daemon” style mode. For shells / REPLs, see
<a href="struct.Command.html#method.multicall" title="method clap::Command::multicall"><code>Command::multicall</code></a>.</p>
<h5 id="examples-28"><a class="doc-anchor" href="#examples-28">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.no_binary_name(<span class="bool-val">true</span>)
.arg(<span class="macro">arg!</span>(&lt;cmd&gt; ... <span class="string">"commands to run"</span>))
.get_matches_from(<span class="macro">vec!</span>[<span class="string">"command"</span>, <span class="string">"set"</span>]);
<span class="kw">let </span>cmds: 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>(cmds, [<span class="string">"command"</span>, <span class="string">"set"</span>]);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.ignore_errors" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1101">source</a><h4 class="code-header">pub fn <a href="#method.ignore_errors" class="fn">ignore_errors</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Try not to fail on parse errors, like missing option values.</p>
<p><strong>NOTE:</strong> This choice is propagated to all child subcommands.</p>
<h5 id="examples-29"><a class="doc-anchor" href="#examples-29">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>cmd = Command::new(<span class="string">"cmd"</span>)
.ignore_errors(<span class="bool-val">true</span>)
.arg(<span class="macro">arg!</span>(-c --config &lt;FILE&gt; <span class="string">"Sets a custom config file"</span>))
.arg(<span class="macro">arg!</span>(-x --stuff &lt;FILE&gt; <span class="string">"Sets a custom stuff file"</span>))
.arg(<span class="macro">arg!</span>(f: -f <span class="string">"Flag"</span>));
<span class="kw">let </span>r = cmd.try_get_matches_from(<span class="macro">vec!</span>[<span class="string">"cmd"</span>, <span class="string">"-c"</span>, <span class="string">"file"</span>, <span class="string">"-f"</span>, <span class="string">"-x"</span>]);
<span class="macro">assert!</span>(r.is_ok(), <span class="string">"unexpected error: {r:?}"</span>);
<span class="kw">let </span>m = r.unwrap();
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"config"</span>).unwrap(), <span class="string">"file"</span>);
<span class="macro">assert!</span>(m.get_flag(<span class="string">"f"</span>));
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"stuff"</span>), <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.args_override_self" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1121">source</a><h4 class="code-header">pub fn <a href="#method.args_override_self" class="fn">args_override_self</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Replace prior occurrences of arguments rather than error</p>
<p>For any argument that would conflict with itself by default (e.g.
<a href="enum.ArgAction.html#variant.Set" title="variant clap::ArgAction::Set"><code>ArgAction::Set</code></a>, it will now override itself.</p>
<p>This is the equivalent to saying the <code>foo</code> arg using <a href="struct.Arg.html#method.overrides_with" title="method clap::Arg::overrides_with"><code>Arg::overrides_with(&quot;foo&quot;)</code></a> for all
defined arguments.</p>
<p><strong>NOTE:</strong> This choice is propagated to all child subcommands.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.dont_delimit_trailing_values" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1150">source</a><h4 class="code-header">pub fn <a href="#method.dont_delimit_trailing_values" class="fn">dont_delimit_trailing_values</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Disables the automatic delimiting of values after <code>--</code> or when <a href="struct.Arg.html#method.trailing_var_arg" title="method clap::Arg::trailing_var_arg"><code>Arg::trailing_var_arg</code></a>
was used.</p>
<p><strong>NOTE:</strong> The same thing can be done manually by setting the final positional argument to
<a href="struct.Arg.html#method.value_delimiter" title="method clap::Arg::value_delimiter"><code>Arg::value_delimiter(None)</code></a>. Using this setting is safer, because its easier to locate
when making changes.</p>
<p><strong>NOTE:</strong> This choice is propagated to all child subcommands.</p>
<h5 id="examples-30"><a class="doc-anchor" href="#examples-30">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.dont_delimit_trailing_values(<span class="bool-val">true</span>)
.get_matches();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.color" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1177">source</a><h4 class="code-header">pub fn <a href="#method.color" class="fn">color</a>(self, color: <a class="enum" href="enum.ColorChoice.html" title="enum clap::ColorChoice">ColorChoice</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets when to color output.</p>
<p><strong>NOTE:</strong> This choice is propagated to all child subcommands.</p>
<p><strong>NOTE:</strong> Default behaviour is <a href="enum.ColorChoice.html#variant.Auto" title="variant clap::ColorChoice::Auto"><code>ColorChoice::Auto</code></a>.</p>
<h5 id="examples-31"><a class="doc-anchor" href="#examples-31">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.color(ColorChoice::Never)
.get_matches();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.styles" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1212">source</a><h4 class="code-header">pub fn <a href="#method.styles" class="fn">styles</a>(self, styles: <a class="struct" href="builder/struct.Styles.html" title="struct clap::builder::Styles">Styles</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets the <a href="builder/struct.Styles.html" title="struct clap::builder::Styles"><code>Styles</code></a> for terminal output</p>
<p><strong>NOTE:</strong> This choice is propagated to all child subcommands.</p>
<p><strong>NOTE:</strong> Default behaviour is <a href="builder/struct.Styles.html#method.default" title="associated function clap::builder::Styles::default"><code>Styles::default</code></a>.</p>
<h5 id="examples-32"><a class="doc-anchor" href="#examples-32">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>styles = styling::Styles::styled()
.header(styling::AnsiColor::Green.on_default() | styling::Effects::BOLD)
.usage(styling::AnsiColor::Green.on_default() | styling::Effects::BOLD)
.literal(styling::AnsiColor::Blue.on_default() | styling::Effects::BOLD)
.placeholder(styling::AnsiColor::Cyan.on_default());
Command::new(<span class="string">"myprog"</span>)
.styles(styles)
.get_matches();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.term_width" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1243">source</a><h4 class="code-header">pub fn <a href="#method.term_width" class="fn">term_width</a>(self, width: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets the terminal width at which to wrap help messages.</p>
<p>Using <code>0</code> will ignore terminal widths and use source formatting.</p>
<p>Defaults to current terminal width when <code>wrap_help</code> feature flag is enabled. If current
width cannot be determined, the default is 100.</p>
<p><strong><code>unstable-v5</code> feature</strong>: Defaults to unbound, being subject to
<a href="struct.Command.html#method.max_term_width" title="method clap::Command::max_term_width"><code>Command::max_term_width</code></a>.</p>
<p><strong>NOTE:</strong> This setting applies globally and <em>not</em> on a per-command basis.</p>
<p><strong>NOTE:</strong> This requires the <code>wrap_help</code> feature</p>
<h5 id="examples-33"><a class="doc-anchor" href="#examples-33">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.term_width(<span class="number">80</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.max_term_width" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1273">source</a><h4 class="code-header">pub fn <a href="#method.max_term_width" class="fn">max_term_width</a>(self, width: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.usize.html">usize</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Limit the line length for wrapping help when using the current terminals width.</p>
<p>This only applies when <a href="struct.Command.html#method.term_width" title="method clap::Command::term_width"><code>term_width</code></a> is unset so that the current
terminals width will be used. See <a href="struct.Command.html#method.term_width" title="method clap::Command::term_width"><code>Command::term_width</code></a> for more details.</p>
<p>Using <code>0</code> will ignore this, always respecting <a href="struct.Command.html#method.term_width" title="method clap::Command::term_width"><code>Command::term_width</code></a> (default).</p>
<p><strong><code>unstable-v5</code> feature</strong>: Defaults to 100.</p>
<p><strong>NOTE:</strong> This setting applies globally and <em>not</em> on a per-command basis.</p>
<p><strong>NOTE:</strong> This requires the <code>wrap_help</code> feature</p>
<h5 id="examples-34"><a class="doc-anchor" href="#examples-34">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.max_term_width(<span class="number">100</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.disable_version_flag" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1323">source</a><h4 class="code-header">pub fn <a href="#method.disable_version_flag" class="fn">disable_version_flag</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Disables <code>-V</code> and <code>--version</code> flag.</p>
<h5 id="examples-35"><a class="doc-anchor" href="#examples-35">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>res = Command::new(<span class="string">"myprog"</span>)
.version(<span class="string">"1.0.0"</span>)
.disable_version_flag(<span class="bool-val">true</span>)
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"myprog"</span>, <span class="string">"--version"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::UnknownArgument);</code></pre></div>
<p>You can create a custom version flag with <a href="enum.ArgAction.html#variant.Version" title="variant clap::ArgAction::Version"><code>ArgAction::Version</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 = Command::new(<span class="string">"myprog"</span>)
.version(<span class="string">"1.0.0"</span>)
<span class="comment">// Remove the `-V` short flag
</span>.disable_version_flag(<span class="bool-val">true</span>)
.arg(
Arg::new(<span class="string">"version"</span>)
.long(<span class="string">"version"</span>)
.action(ArgAction::Version)
.help(<span class="string">"Print version"</span>)
);
<span class="kw">let </span>res = cmd.try_get_matches_from_mut(<span class="macro">vec!</span>[
<span class="string">"myprog"</span>, <span class="string">"-V"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::UnknownArgument);
<span class="kw">let </span>res = cmd.try_get_matches_from_mut(<span class="macro">vec!</span>[
<span class="string">"myprog"</span>, <span class="string">"--version"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::DisplayVersion);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.propagate_version" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1353">source</a><h4 class="code-header">pub fn <a href="#method.propagate_version" class="fn">propagate_version</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Specifies to use the version of the current command for all <a href="struct.Command.html#method.subcommand" title="method clap::Command::subcommand"><code>subcommands</code></a>.</p>
<p>Defaults to <code>false</code>; subcommands have independent version strings from their parents.</p>
<p><strong>NOTE:</strong> This choice is propagated to all child subcommands.</p>
<h5 id="examples-36"><a class="doc-anchor" href="#examples-36">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.version(<span class="string">"v1.1"</span>)
.propagate_version(<span class="bool-val">true</span>)
.subcommand(Command::new(<span class="string">"test"</span>))
.get_matches();
<span class="comment">// running `$ myprog test --version` will display
// "myprog-test v1.1"</span></code></pre></div>
</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/command.rs.html#1375">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.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Places the help string for all arguments and subcommands on the line after them.</p>
<p><strong>NOTE:</strong> This choice is propagated to all child subcommands.</p>
<h5 id="examples-37"><a class="doc-anchor" href="#examples-37">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.next_line_help(<span class="bool-val">true</span>)
.get_matches();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.disable_help_flag" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1430">source</a><h4 class="code-header">pub fn <a href="#method.disable_help_flag" class="fn">disable_help_flag</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Disables <code>-h</code> and <code>--help</code> flag.</p>
<p><strong>NOTE:</strong> This choice is propagated to all child subcommands.</p>
<h5 id="examples-38"><a class="doc-anchor" href="#examples-38">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>res = Command::new(<span class="string">"myprog"</span>)
.disable_help_flag(<span class="bool-val">true</span>)
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"myprog"</span>, <span class="string">"-h"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::UnknownArgument);</code></pre></div>
<p>You can create a custom help flag with <a href="enum.ArgAction.html#variant.Help" title="variant clap::ArgAction::Help"><code>ArgAction::Help</code></a>, <a href="enum.ArgAction.html#variant.HelpShort" title="variant clap::ArgAction::HelpShort"><code>ArgAction::HelpShort</code></a>, or
<a href="enum.ArgAction.html#variant.HelpLong" title="variant clap::ArgAction::HelpLong"><code>ArgAction::HelpLong</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 = Command::new(<span class="string">"myprog"</span>)
<span class="comment">// Change help short flag to `?`
</span>.disable_help_flag(<span class="bool-val">true</span>)
.arg(
Arg::new(<span class="string">"help"</span>)
.short(<span class="string">'?'</span>)
.long(<span class="string">"help"</span>)
.action(ArgAction::Help)
.help(<span class="string">"Print help"</span>)
);
<span class="kw">let </span>res = cmd.try_get_matches_from_mut(<span class="macro">vec!</span>[
<span class="string">"myprog"</span>, <span class="string">"-h"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::UnknownArgument);
<span class="kw">let </span>res = cmd.try_get_matches_from_mut(<span class="macro">vec!</span>[
<span class="string">"myprog"</span>, <span class="string">"-?"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::DisplayHelp);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.disable_help_subcommand" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1461">source</a><h4 class="code-header">pub fn <a href="#method.disable_help_subcommand" class="fn">disable_help_subcommand</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Disables the <code>help</code> <a href="struct.Command.html#method.subcommand" title="method clap::Command::subcommand"><code>subcommand</code></a>.</p>
<p><strong>NOTE:</strong> This choice is propagated to all child subcommands.</p>
<h5 id="examples-39"><a class="doc-anchor" href="#examples-39">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>res = Command::new(<span class="string">"myprog"</span>)
.disable_help_subcommand(<span class="bool-val">true</span>)
<span class="comment">// Normally, creating a subcommand causes a `help` subcommand to automatically
// be generated as well
</span>.subcommand(Command::new(<span class="string">"test"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"myprog"</span>, <span class="string">"help"
</span>]);
<span class="macro">assert!</span>(res.is_err());
<span class="macro">assert_eq!</span>(res.unwrap_err().kind(), ErrorKind::InvalidSubcommand);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.disable_colored_help" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1483">source</a><h4 class="code-header">pub fn <a href="#method.disable_colored_help" class="fn">disable_colored_help</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Disables colorized help messages.</p>
<p><strong>NOTE:</strong> This choice is propagated to all child subcommands.</p>
<h5 id="examples-40"><a class="doc-anchor" href="#examples-40">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.disable_colored_help(<span class="bool-val">true</span>)
.get_matches();</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.help_expected" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1529">source</a><h4 class="code-header">pub fn <a href="#method.help_expected" class="fn">help_expected</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Panic if help descriptions are omitted.</p>
<p><strong>NOTE:</strong> When deriving <a href="trait.Parser.html" title="trait clap::Parser"><code>Parser</code></a>, you could instead check this at
compile-time with <code>#![deny(missing_docs)]</code></p>
<p><strong>NOTE:</strong> This choice is propagated to all child subcommands.</p>
<h5 id="examples-41"><a class="doc-anchor" href="#examples-41">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.help_expected(<span class="bool-val">true</span>)
.arg(
Arg::new(<span class="string">"foo"</span>).help(<span class="string">"It does foo stuff"</span>)
<span class="comment">// As required via `help_expected`, a help message was supplied
</span>)</code></pre></div>
<h5 id="panics-9"><a class="doc-anchor" href="#panics-9">§</a>Panics</h5>
<p>On debug builds:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myapp"</span>)
.help_expected(<span class="bool-val">true</span>)
.arg(
Arg::new(<span class="string">"foo"</span>)
<span class="comment">// Someone forgot to put .about("...") here
// Since the setting `help_expected` is activated, this will lead to
// a panic (if you are in debug mode)
</span>)</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/command.rs.html#1555">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.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Tells <code>clap</code> <em>not</em> to print possible values when displaying help information.</p>
<p>This can be useful if there are many values, or they are explained elsewhere.</p>
<p>To set this per argument, see
<a href="struct.Arg.html#method.hide_possible_values" title="method clap::Arg::hide_possible_values"><code>Arg::hide_possible_values</code></a>.</p>
<p><strong>NOTE:</strong> This choice is propagated to all child subcommands.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.infer_long_args" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1576">source</a><h4 class="code-header">pub fn <a href="#method.infer_long_args" class="fn">infer_long_args</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Allow partial matches of long arguments or their <a href="struct.Command.html#method.aliases" title="method clap::Command::aliases">aliases</a>.</p>
<p>For example, to match an argument named <code>--test</code>, one could use <code>--t</code>, <code>--te</code>, <code>--tes</code>, and
<code>--test</code>.</p>
<p><strong>NOTE:</strong> The match <em>must not</em> be ambiguous at all in order to succeed. i.e. to match
<code>--te</code> to <code>--test</code> there could not also be another argument or alias <code>--temp</code> because both
start with <code>--te</code></p>
<p><strong>NOTE:</strong> This choice is propagated to all child subcommands.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.infer_subcommands" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1618">source</a><h4 class="code-header">pub fn <a href="#method.infer_subcommands" class="fn">infer_subcommands</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Allow partial matches of <a href="struct.Command.html#method.subcommand" title="method clap::Command::subcommand">subcommand</a> names and their <a href="struct.Command.html#method.aliases" title="method clap::Command::aliases">aliases</a>.</p>
<p>For example, to match a subcommand named <code>test</code>, one could use <code>t</code>, <code>te</code>, <code>tes</code>, and
<code>test</code>.</p>
<p><strong>NOTE:</strong> The match <em>must not</em> be ambiguous at all in order to succeed. i.e. to match <code>te</code>
to <code>test</code> there could not also be a subcommand or alias <code>temp</code> because both start with <code>te</code></p>
<p><strong>CAUTION:</strong> This setting can interfere with <a href="struct.Arg.html#method.index" title="method clap::Arg::index">positional/free arguments</a>, take care when
designing CLIs which allow inferred subcommands and have potential positional/free
arguments whose values could start with the same characters as subcommands. If this is the
case, its recommended to use settings such as <a href="struct.Command.html#method.args_conflicts_with_subcommands" title="method clap::Command::args_conflicts_with_subcommands"><code>Command::args_conflicts_with_subcommands</code></a> in
conjunction with this setting.</p>
<p><strong>NOTE:</strong> This choice is propagated to all child subcommands.</p>
<h5 id="examples-42"><a class="doc-anchor" href="#examples-42">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"prog"</span>)
.infer_subcommands(<span class="bool-val">true</span>)
.subcommand(Command::new(<span class="string">"test"</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"te"
</span>]);
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">"test"</span>));</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Command-2" class="impl"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1630">source</a><a href="#impl-Command-2" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h3></section></summary><div class="docblock"><h4 id="command-specific-settings"><a class="doc-anchor" href="#command-specific-settings">§</a>Command-specific Settings</h4>
<p>These apply only to the current command and are not inherited by subcommands.</p>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.name" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1644">source</a><h4 class="code-header">pub fn <a href="#method.name" class="fn">name</a>(self, name: impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>(Re)Sets the programs name.</p>
<p>See <a href="struct.Command.html#method.new" title="associated function clap::Command::new"><code>Command::new</code></a> for more details.</p>
<h5 id="examples-43"><a class="doc-anchor" href="#examples-43">§</a>Examples</h5>
<div class="example-wrap ignore"><a href="#" class="tooltip" title="This example is not tested"></a><pre class="rust rust-example-rendered"><code><span class="kw">let </span>cmd = <span class="macro">clap::command!</span>()
.name(<span class="string">"foo"</span>);
<span class="comment">// continued logic goes here, such as `cmd.get_matches()` etc.</span></code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.bin_name" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1671">source</a><h4 class="code-header">pub fn <a href="#method.bin_name" class="fn">bin_name</a>(self, name: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.77.2/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Overrides the runtime-determined name of the binary for help and error messages.</p>
<p>This should only be used when absolutely necessary, such as when the binary name for your
application is misleading, or perhaps <em>not</em> how the user should invoke your program.</p>
<p><strong>Pro-tip:</strong> When building things such as third party <code>cargo</code>
subcommands, this setting <strong>should</strong> be used!</p>
<p><strong>NOTE:</strong> This <em>does not</em> change or set the name of the binary file on
disk. It only changes what clap thinks the name is for the purposes of
error or help messages.</p>
<h5 id="examples-44"><a class="doc-anchor" href="#examples-44">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"My Program"</span>)
.bin_name(<span class="string">"my_binary"</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.display_name" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1688">source</a><h4 class="code-header">pub fn <a href="#method.display_name" class="fn">display_name</a>(self, name: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.77.2/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Overrides the runtime-determined display name of the program for help and error messages.</p>
<h5 id="examples-45"><a class="doc-anchor" href="#examples-45">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"My Program"</span>)
.display_name(<span class="string">"my_program"</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.author" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1712">source</a><h4 class="code-header">pub fn <a href="#method.author" class="fn">author</a>(self, author: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets the author(s) for the help message.</p>
<p><strong>Pro-tip:</strong> Use <code>clap</code>s convenience macro [<code>crate_authors!</code>] to
automatically set your applications author(s) to the same thing as your
crate at compile time.</p>
<p><strong>NOTE:</strong> A custom <a href="struct.Command.html#method.help_template" title="method clap::Command::help_template"><code>help_template</code></a> is needed for author to show
up.</p>
<h5 id="examples-46"><a class="doc-anchor" href="#examples-46">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.author(<span class="string">"Me, me@mymain.com"</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.about" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1736">source</a><h4 class="code-header">pub fn <a href="#method.about" class="fn">about</a>(self, about: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets the programs description for the short help (<code>-h</code>).</p>
<p>If <a href="struct.Command.html#method.long_about" title="method clap::Command::long_about"><code>Command::long_about</code></a> is not specified, this message will be displayed for <code>--help</code>.</p>
<p><strong>NOTE:</strong> Only <code>Command::about</code> (short format) is used in completion
script generation in order to be concise.</p>
<p>See also <a href="crate::crate_description!"><code>crate_description!</code></a>.</p>
<h5 id="examples-47"><a class="doc-anchor" href="#examples-47">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.about(<span class="string">"Does really amazing things for great people"</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.long_about" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1762">source</a><h4 class="code-header">pub fn <a href="#method.long_about" class="fn">long_about</a>(self, long_about: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets the programs description for the long help (<code>--help</code>).</p>
<p>If <a href="struct.Command.html#method.about" title="method clap::Command::about"><code>Command::about</code></a> is not specified, this message will be displayed for <code>-h</code>.</p>
<p><strong>NOTE:</strong> Only <a href="struct.Command.html#method.about" title="method clap::Command::about"><code>Command::about</code></a> (short format) is used in completion
script generation in order to be concise.</p>
<h5 id="examples-48"><a class="doc-anchor" href="#examples-48">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.long_about(
<span class="string">"Does really amazing things to great people. Now let's talk a little
more in depth about how this subcommand really works. It may take about
a few lines of text, but that's ok!"</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.after_help" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1785">source</a><h4 class="code-header">pub fn <a href="#method.after_help" class="fn">after_help</a>(self, help: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Free-form help text for after auto-generated short help (<code>-h</code>).</p>
<p>This is often used to describe how to use the arguments, caveats to be noted, or license
and contact information.</p>
<p>If <a href="struct.Command.html#method.after_long_help" title="method clap::Command::after_long_help"><code>Command::after_long_help</code></a> is not specified, this message will be displayed for <code>--help</code>.</p>
<h5 id="examples-49"><a class="doc-anchor" href="#examples-49">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.after_help(<span class="string">"Does really amazing things for great people... but be careful with -R!"</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.after_long_help" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1808">source</a><h4 class="code-header">pub fn <a href="#method.after_long_help" class="fn">after_long_help</a>(self, help: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Free-form help text for after auto-generated long help (<code>--help</code>).</p>
<p>This is often used to describe how to use the arguments, caveats to be noted, or license
and contact information.</p>
<p>If <a href="struct.Command.html#method.after_help" title="method clap::Command::after_help"><code>Command::after_help</code></a> is not specified, this message will be displayed for <code>-h</code>.</p>
<h5 id="examples-50"><a class="doc-anchor" href="#examples-50">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.after_long_help(<span class="string">"Does really amazing things to great people... but be careful with -R, \
like, for real, be careful with this!"</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.before_help" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1829">source</a><h4 class="code-header">pub fn <a href="#method.before_help" class="fn">before_help</a>(self, help: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Free-form help text for before auto-generated short help (<code>-h</code>).</p>
<p>This is often used for header, copyright, or license information.</p>
<p>If <a href="struct.Command.html#method.before_long_help" title="method clap::Command::before_long_help"><code>Command::before_long_help</code></a> is not specified, this message will be displayed for <code>--help</code>.</p>
<h5 id="examples-51"><a class="doc-anchor" href="#examples-51">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.before_help(<span class="string">"Some info I'd like to appear before the help info"</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.before_long_help" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1850">source</a><h4 class="code-header">pub fn <a href="#method.before_long_help" class="fn">before_long_help</a>(self, help: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Free-form help text for before auto-generated long help (<code>--help</code>).</p>
<p>This is often used for header, copyright, or license information.</p>
<p>If <a href="struct.Command.html#method.before_help" title="method clap::Command::before_help"><code>Command::before_help</code></a> is not specified, this message will be displayed for <code>-h</code>.</p>
<h5 id="examples-52"><a class="doc-anchor" href="#examples-52">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.before_long_help(<span class="string">"Some verbose and long info I'd like to appear before the help info"</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.version" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1873">source</a><h4 class="code-header">pub fn <a href="#method.version" class="fn">version</a>(self, ver: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets the version for the short version (<code>-V</code>) and help messages.</p>
<p>If <a href="struct.Command.html#method.long_version" title="method clap::Command::long_version"><code>Command::long_version</code></a> is not specified, this message will be displayed for <code>--version</code>.</p>
<p><strong>Pro-tip:</strong> Use <code>clap</code>s convenience macro [<code>crate_version!</code>] to
automatically set your applications version to the same thing as your
crate at compile time.</p>
<h5 id="examples-53"><a class="doc-anchor" href="#examples-53">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.version(<span class="string">"v0.1.24"</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.long_version" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1901">source</a><h4 class="code-header">pub fn <a href="#method.long_version" class="fn">long_version</a>(self, ver: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets the version for the long version (<code>--version</code>) and help messages.</p>
<p>If <a href="struct.Command.html#method.version" title="method clap::Command::version"><code>Command::version</code></a> is not specified, this message will be displayed for <code>-V</code>.</p>
<p><strong>Pro-tip:</strong> Use <code>clap</code>s convenience macro [<code>crate_version!</code>] to
automatically set your applications version to the same thing as your
crate at compile time.</p>
<h5 id="examples-54"><a class="doc-anchor" href="#examples-54">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.long_version(
<span class="string">"v0.1.24
commit: abcdef89726d
revision: 123
release: 2
binary: myprog"</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.override_usage" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1946">source</a><h4 class="code-header">pub fn <a href="#method.override_usage" class="fn">override_usage</a>(self, usage: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Overrides the <code>clap</code> generated usage string for help and error messages.</p>
<p><strong>NOTE:</strong> Using this setting disables <code>clap</code>s “context-aware” usage
strings. After this setting is set, this will be <em>the only</em> usage string
displayed to the user!</p>
<p><strong>NOTE:</strong> Multiple usage lines may be present in the usage argument, but
some rules need to be followed to ensure the usage lines are formatted
correctly by the default help formatter:</p>
<ul>
<li>Do not indent the first usage line.</li>
<li>Indent all subsequent usage lines with seven spaces.</li>
<li>The last line must not end with a newline.</li>
</ul>
<h5 id="examples-55"><a class="doc-anchor" href="#examples-55">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.override_usage(<span class="string">"myapp [-clDas] &lt;some_file&gt;"</span>)</code></pre></div>
<p>Or for multiple usage lines:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.override_usage(
<span class="string">"myapp -X [-a] [-b] &lt;file&gt;\n \
myapp -Y [-c] &lt;file1&gt; &lt;file2&gt;\n \
myapp -Z [-d|-e]"
</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.override_help" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#1984">source</a><h4 class="code-header">pub fn <a href="#method.override_help" class="fn">override_help</a>(self, help: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Overrides the <code>clap</code> generated help message (both <code>-h</code> and <code>--help</code>).</p>
<p>This should only be used when the auto-generated message does not suffice.</p>
<p><strong>NOTE:</strong> This <strong>only</strong> replaces the help message for the current
command, meaning if you are using subcommands, those help messages will
still be auto-generated unless you specify a <a href="struct.Command.html#method.override_help" title="method clap::Command::override_help"><code>Command::override_help</code></a> for
them as well.</p>
<h5 id="examples-56"><a class="doc-anchor" href="#examples-56">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myapp"</span>)
.override_help(<span class="string">"myapp v1.0\n\
Does awesome things\n\
(C) me@mail.com\n\n\
Usage: myapp &lt;opts&gt; &lt;command&gt;\n\n\
Options:\n\
-h, --help Display this message\n\
-V, --version Display version info\n\
-s &lt;stuff&gt; Do something with stuff\n\
-v Be verbose\n\n\
Commands:\n\
help Print this message\n\
work Do some work"</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.help_template" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#2056">source</a><h4 class="code-header">pub fn <a href="#method.help_template" class="fn">help_template</a>(self, s: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets the help template to be used, overriding the default format.</p>
<p><strong>NOTE:</strong> The template system is by design very simple. Therefore, the
tags have to be written in the lowercase and without spacing.</p>
<p>Tags are given inside curly brackets.</p>
<p>Valid tags are:</p>
<ul>
<li><code>{name}</code> - Display name for the (sub-)command.</li>
<li><code>{bin}</code> - Binary name.(deprecated)</li>
<li><code>{version}</code> - Version number.</li>
<li><code>{author}</code> - Author information.</li>
<li><code>{author-with-newline}</code> - Author followed by <code>\n</code>.</li>
<li><code>{author-section}</code> - Author preceded and followed by <code>\n</code>.</li>
<li><code>{about}</code> - General description (from <a href="struct.Command.html#method.about" title="method clap::Command::about"><code>Command::about</code></a> or
<a href="struct.Command.html#method.long_about" title="method clap::Command::long_about"><code>Command::long_about</code></a>).</li>
<li><code>{about-with-newline}</code> - About followed by <code>\n</code>.</li>
<li><code>{about-section}</code> - About preceded and followed by \n.</li>
<li><code>{usage-heading}</code> - Automatically generated usage heading.</li>
<li><code>{usage}</code> - Automatically generated or given usage string.</li>
<li><code>{all-args}</code> - Help for all arguments (options, flags, positional
arguments, and subcommands) including titles.</li>
<li><code>{options}</code> - Help for options.</li>
<li><code>{positionals}</code> - Help for positional arguments.</li>
<li><code>{subcommands}</code> - Help for subcommands.</li>
<li><code>{tab}</code> - Standard tab sized used within clap</li>
<li><code>{after-help}</code> - Help from <a href="struct.Command.html#method.after_help" title="method clap::Command::after_help"><code>Command::after_help</code></a> or <a href="struct.Command.html#method.after_long_help" title="method clap::Command::after_long_help"><code>Command::after_long_help</code></a>.</li>
<li><code>{before-help}</code> - Help from <a href="struct.Command.html#method.before_help" title="method clap::Command::before_help"><code>Command::before_help</code></a> or <a href="struct.Command.html#method.before_long_help" title="method clap::Command::before_long_help"><code>Command::before_long_help</code></a>.</li>
</ul>
<h5 id="examples-57"><a class="doc-anchor" href="#examples-57">§</a>Examples</h5>
<p>For a very brief help:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.version(<span class="string">"1.0"</span>)
.help_template(<span class="string">"{name} ({version}) - {usage}"</span>)</code></pre></div>
<p>For showing more application context:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.version(<span class="string">"1.0"</span>)
.help_template(<span class="string">"\
{before-help}{name} {version}
{author-with-newline}{about-with-newline}
{usage-heading} {usage}
{all-args}{after-help}
"</span>)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.flatten_help" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#2098">source</a><h4 class="code-header">pub fn <a href="#method.flatten_help" class="fn">flatten_help</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Flatten subcommand help into the current commands help</p>
<p>This shows a summary of subcommands within the usage and help for the current command, similar to
<code>git stash --help</code> showing information on <code>push</code>, <code>pop</code>, etc.
To see more information, a user can still pass <code>--help</code> to the individual subcommands.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.next_help_heading" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#2119">source</a><h4 class="code-header">pub fn <a href="#method.next_help_heading" class="fn">next_help_heading</a>(self, heading: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Set the default section heading for future args.</p>
<p>This will be used for any arg that hasnt had <a href="struct.Arg.html#method.help_heading" title="method clap::Arg::help_heading"><code>Arg::help_heading</code></a> called.</p>
<p>This is useful if the default <code>Options</code> or <code>Arguments</code> headings are
not specific enough for ones use case.</p>
<p>For subcommands, see <a href="struct.Command.html#method.subcommand_help_heading" title="method clap::Command::subcommand_help_heading"><code>Command::subcommand_help_heading</code></a></p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.next_display_order" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#2129">source</a><h4 class="code-header">pub fn <a href="#method.next_display_order" class="fn">next_display_order</a>(self, disp_ord: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.usize.html">usize</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Change the starting value for assigning future display orders for args.</p>
<p>This will be used for any arg that hasnt had <a href="struct.Arg.html#method.display_order" title="method clap::Arg::display_order"><code>Arg::display_order</code></a> called.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.arg_required_else_help" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#2150">source</a><h4 class="code-header">pub fn <a href="#method.arg_required_else_help" class="fn">arg_required_else_help</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Exit gracefully if no arguments are present (e.g. <code>$ myprog</code>).</p>
<p><strong>NOTE:</strong> <a href="struct.Command.html#method.subcommand" title="method clap::Command::subcommand"><code>subcommands</code></a> count as arguments</p>
<h5 id="examples-58"><a class="doc-anchor" href="#examples-58">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.arg_required_else_help(<span class="bool-val">true</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.allow_missing_positional" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#2309">source</a><h4 class="code-header">pub fn <a href="#method.allow_missing_positional" class="fn">allow_missing_positional</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Allows one to implement two styles of CLIs where positionals can be used out of order.</p>
<p>The first example is a CLI where the second to last positional argument is optional, but
the final positional argument is required. Such as <code>$ prog [optional] &lt;required&gt;</code> where one
of the two following usages is allowed:</p>
<ul>
<li><code>$ prog [optional] &lt;required&gt;</code></li>
<li><code>$ prog &lt;required&gt;</code></li>
</ul>
<p>This would otherwise not be allowed. This is useful when <code>[optional]</code> has a default value.</p>
<p><strong>Note:</strong> when using this style of “missing positionals” the final positional <em>must</em> be
<a href="struct.Arg.html#method.required" title="method clap::Arg::required">required</a> if <code>--</code> will not be used to skip to the final positional argument.</p>
<p><strong>Note:</strong> This style also only allows a single positional argument to be “skipped” without
the use of <code>--</code>. To skip more than one, see the second example.</p>
<p>The second example is when one wants to skip multiple optional positional arguments, and use
of the <code>--</code> operator is OK (but not required if all arguments will be specified anyways).</p>
<p>For example, imagine a CLI which has three positional arguments <code>[foo] [bar] [baz]...</code> where
<code>baz</code> accepts multiple values (similar to man <code>ARGS...</code> style training arguments).</p>
<p>With this setting the following invocations are posisble:</p>
<ul>
<li><code>$ prog foo bar baz1 baz2 baz3</code></li>
<li><code>$ prog foo -- baz1 baz2 baz3</code></li>
<li><code>$ prog -- baz1 baz2 baz3</code></li>
</ul>
<h5 id="examples-59"><a class="doc-anchor" href="#examples-59">§</a>Examples</h5>
<p>Style number one from above:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="comment">// Assume there is an external subcommand named "subcmd"
</span><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.allow_missing_positional(<span class="bool-val">true</span>)
.arg(Arg::new(<span class="string">"arg1"</span>))
.arg(Arg::new(<span class="string">"arg2"</span>)
.required(<span class="bool-val">true</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"other"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"arg1"</span>), <span class="prelude-val">None</span>);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"arg2"</span>).unwrap(), <span class="string">"other"</span>);</code></pre></div>
<p>Now the same example, but using a default value for the first optional positional argument</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="comment">// Assume there is an external subcommand named "subcmd"
</span><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.allow_missing_positional(<span class="bool-val">true</span>)
.arg(Arg::new(<span class="string">"arg1"</span>)
.default_value(<span class="string">"something"</span>))
.arg(Arg::new(<span class="string">"arg2"</span>)
.required(<span class="bool-val">true</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"other"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"arg1"</span>).unwrap(), <span class="string">"something"</span>);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"arg2"</span>).unwrap(), <span class="string">"other"</span>);</code></pre></div>
<p>Style number two from above:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="comment">// Assume there is an external subcommand named "subcmd"
</span><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.allow_missing_positional(<span class="bool-val">true</span>)
.arg(Arg::new(<span class="string">"foo"</span>))
.arg(Arg::new(<span class="string">"bar"</span>))
.arg(Arg::new(<span class="string">"baz"</span>).action(ArgAction::Set).num_args(<span class="number">1</span>..))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"foo"</span>, <span class="string">"bar"</span>, <span class="string">"baz1"</span>, <span class="string">"baz2"</span>, <span class="string">"baz3"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"foo"</span>).unwrap(), <span class="string">"foo"</span>);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"bar"</span>).unwrap(), <span class="string">"bar"</span>);
<span class="macro">assert_eq!</span>(m.get_many::&lt;String&gt;(<span class="string">"baz"</span>).unwrap().collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;(), <span class="kw-2">&amp;</span>[<span class="string">"baz1"</span>, <span class="string">"baz2"</span>, <span class="string">"baz3"</span>]);</code></pre></div>
<p>Now nofice if we dont specify <code>foo</code> or <code>baz</code> but use the <code>--</code> operator.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="comment">// Assume there is an external subcommand named "subcmd"
</span><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.allow_missing_positional(<span class="bool-val">true</span>)
.arg(Arg::new(<span class="string">"foo"</span>))
.arg(Arg::new(<span class="string">"bar"</span>))
.arg(Arg::new(<span class="string">"baz"</span>).action(ArgAction::Set).num_args(<span class="number">1</span>..))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"prog"</span>, <span class="string">"--"</span>, <span class="string">"baz1"</span>, <span class="string">"baz2"</span>, <span class="string">"baz3"
</span>]);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"foo"</span>), <span class="prelude-val">None</span>);
<span class="macro">assert_eq!</span>(m.get_one::&lt;String&gt;(<span class="string">"bar"</span>), <span class="prelude-val">None</span>);
<span class="macro">assert_eq!</span>(m.get_many::&lt;String&gt;(<span class="string">"baz"</span>).unwrap().collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;(), <span class="kw-2">&amp;</span>[<span class="string">"baz1"</span>, <span class="string">"baz2"</span>, <span class="string">"baz3"</span>]);</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Command-3" class="impl"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#2319">source</a><a href="#impl-Command-3" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h3></section></summary><div class="docblock"><h4 id="subcommand-specific-settings"><a class="doc-anchor" href="#subcommand-specific-settings">§</a>Subcommand-specific Settings</h4></div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.short_flag" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#2347">source</a><h4 class="code-header">pub fn <a href="#method.short_flag" class="fn">short_flag</a>(self, short: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.char.html">char</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets the short version of the subcommand flag without the preceding <code>-</code>.</p>
<p>Allows the subcommand to be used as if it were an <a href="struct.Arg.html#method.short" title="method clap::Arg::short"><code>Arg::short</code></a>.</p>
<h5 id="examples-60"><a class="doc-anchor" href="#examples-60">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>matches = Command::new(<span class="string">"pacman"</span>)
.subcommand(
Command::new(<span class="string">"sync"</span>).short_flag(<span class="string">'S'</span>).arg(
Arg::new(<span class="string">"search"</span>)
.short(<span class="string">'s'</span>)
.long(<span class="string">"search"</span>)
.action(ArgAction::SetTrue)
.help(<span class="string">"search remote repositories for matching strings"</span>),
),
)
.get_matches_from(<span class="macro">vec!</span>[<span class="string">"pacman"</span>, <span class="string">"-Ss"</span>]);
<span class="macro">assert_eq!</span>(matches.subcommand_name().unwrap(), <span class="string">"sync"</span>);
<span class="kw">let </span>sync_matches = matches.subcommand_matches(<span class="string">"sync"</span>).unwrap();
<span class="macro">assert!</span>(sync_matches.get_flag(<span class="string">"search"</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.long_flag" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#2386">source</a><h4 class="code-header">pub fn <a href="#method.long_flag" class="fn">long_flag</a>(self, long: impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets the long version of the subcommand flag without the preceding <code>--</code>.</p>
<p>Allows the subcommand to be used as if it were an <a href="struct.Arg.html#method.long" title="method clap::Arg::long"><code>Arg::long</code></a>.</p>
<p><strong>NOTE:</strong> Any leading <code>-</code> characters will be stripped.</p>
<h5 id="examples-61"><a class="doc-anchor" href="#examples-61">§</a>Examples</h5>
<p>To set <code>long_flag</code> use a word containing valid UTF-8 codepoints. If you supply a double leading
<code>--</code> such as <code>--sync</code> they will be stripped. Hyphens in the middle of the word; however,
will <em>not</em> be stripped (i.e. <code>sync-file</code> is allowed).</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>matches = Command::new(<span class="string">"pacman"</span>)
.subcommand(
Command::new(<span class="string">"sync"</span>).long_flag(<span class="string">"sync"</span>).arg(
Arg::new(<span class="string">"search"</span>)
.short(<span class="string">'s'</span>)
.long(<span class="string">"search"</span>)
.action(ArgAction::SetTrue)
.help(<span class="string">"search remote repositories for matching strings"</span>),
),
)
.get_matches_from(<span class="macro">vec!</span>[<span class="string">"pacman"</span>, <span class="string">"--sync"</span>, <span class="string">"--search"</span>]);
<span class="macro">assert_eq!</span>(matches.subcommand_name().unwrap(), <span class="string">"sync"</span>);
<span class="kw">let </span>sync_matches = matches.subcommand_matches(<span class="string">"sync"</span>).unwrap();
<span class="macro">assert!</span>(sync_matches.get_flag(<span class="string">"search"</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/command.rs.html#2418">source</a><h4 class="code-header">pub fn <a href="#method.alias" class="fn">alias</a>(self, name: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets a hidden alias to this subcommand.</p>
<p>This allows the subcommand to be accessed via <em>either</em> the original name, or this given
alias. 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 aliased variants.</p>
<p><strong>NOTE:</strong> Aliases defined with this method are <em>hidden</em> from the help
message. If youre looking for aliases that will be displayed in the help
message, see <a href="struct.Command.html#method.visible_alias" title="method clap::Command::visible_alias"><code>Command::visible_alias</code></a>.</p>
<p><strong>NOTE:</strong> When using aliases and checking for the existence of a
particular subcommand within an <a href="struct.ArgMatches.html" title="struct clap::ArgMatches"><code>ArgMatches</code></a> struct, one only needs to
search for the original name and not all aliases.</p>
<h5 id="examples-62"><a class="doc-anchor" href="#examples-62">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.subcommand(Command::new(<span class="string">"test"</span>)
.alias(<span class="string">"do-stuff"</span>))
.get_matches_from(<span class="macro">vec!</span>[<span class="string">"myprog"</span>, <span class="string">"do-stuff"</span>]);
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">"test"</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.short_flag_alias" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#2445">source</a><h4 class="code-header">pub fn <a href="#method.short_flag_alias" class="fn">short_flag_alias</a>(self, name: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.char.html">char</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Add an alias, which functions as “hidden” short flag subcommand</p>
<p>This will automatically dispatch as if this subcommand was used. 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-63"><a class="doc-anchor" href="#examples-63">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.subcommand(Command::new(<span class="string">"test"</span>).short_flag(<span class="string">'t'</span>)
.short_flag_alias(<span class="string">'d'</span>))
.get_matches_from(<span class="macro">vec!</span>[<span class="string">"myprog"</span>, <span class="string">"-d"</span>]);
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">"test"</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.long_flag_alias" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#2473">source</a><h4 class="code-header">pub fn <a href="#method.long_flag_alias" class="fn">long_flag_alias</a>(self, name: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Add an alias, which functions as a “hidden” long flag subcommand.</p>
<p>This will automatically dispatch as if this subcommand was used. 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-64"><a class="doc-anchor" href="#examples-64">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.subcommand(Command::new(<span class="string">"test"</span>).long_flag(<span class="string">"test"</span>)
.long_flag_alias(<span class="string">"testing"</span>))
.get_matches_from(<span class="macro">vec!</span>[<span class="string">"myprog"</span>, <span class="string">"--testing"</span>]);
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">"test"</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/command.rs.html#2512">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.77.2/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.77.2/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets multiple hidden aliases to this subcommand.</p>
<p>This allows the subcommand to be accessed via <em>either</em> the original name or any of the
given aliases. 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 aliased variants.</p>
<p><strong>NOTE:</strong> Aliases defined with this method are <em>hidden</em> from the help
message. If looking for aliases that will be displayed in the help
message, see <a href="struct.Command.html#method.visible_aliases" title="method clap::Command::visible_aliases"><code>Command::visible_aliases</code></a>.</p>
<p><strong>NOTE:</strong> When using aliases and checking for the existence of a
particular subcommand within an <a href="struct.ArgMatches.html" title="struct clap::ArgMatches"><code>ArgMatches</code></a> struct, one only needs to
search for the original name and not all aliases.</p>
<h5 id="examples-65"><a class="doc-anchor" href="#examples-65">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.subcommand(Command::new(<span class="string">"test"</span>)
.aliases([<span class="string">"do-stuff"</span>, <span class="string">"do-tests"</span>, <span class="string">"tests"</span>]))
.arg(Arg::new(<span class="string">"input"</span>)
.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">"myprog"</span>, <span class="string">"do-tests"</span>]);
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">"test"</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.short_flag_aliases" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#2539">source</a><h4 class="code-header">pub fn <a href="#method.short_flag_aliases" class="fn">short_flag_aliases</a>(
self,
names: impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/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.77.2/std/primitive.char.html">char</a>&gt;
) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Add aliases, which function as “hidden” short flag subcommands.</p>
<p>These will automatically dispatch as if this subcommand was used. 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-66"><a class="doc-anchor" href="#examples-66">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.subcommand(Command::new(<span class="string">"test"</span>).short_flag(<span class="string">'t'</span>)
.short_flag_aliases([<span class="string">'a'</span>, <span class="string">'b'</span>, <span class="string">'c'</span>]))
.arg(Arg::new(<span class="string">"input"</span>)
.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">"myprog"</span>, <span class="string">"-a"</span>]);
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">"test"</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.long_flag_aliases" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#2568">source</a><h4 class="code-header">pub fn <a href="#method.long_flag_aliases" class="fn">long_flag_aliases</a>(
self,
names: impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/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.77.2/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;&gt;
) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Add aliases, which function as “hidden” long flag subcommands.</p>
<p>These will automatically dispatch as if this subcommand was used. 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-67"><a class="doc-anchor" href="#examples-67">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.subcommand(Command::new(<span class="string">"test"</span>).long_flag(<span class="string">"test"</span>)
.long_flag_aliases([<span class="string">"testing"</span>, <span class="string">"testall"</span>, <span class="string">"test_all"</span>]))
.arg(Arg::new(<span class="string">"input"</span>)
.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">"myprog"</span>, <span class="string">"--testing"</span>]);
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">"test"</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/command.rs.html#2604">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="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets a visible alias to this subcommand.</p>
<p>This allows the subcommand to be accessed via <em>either</em> the
original name or the given alias. This is more efficient and easier
than creating hidden subcommands as one only needs to check for
the existence of this command and not all aliased variants.</p>
<p><strong>NOTE:</strong> The alias defined with this method is <em>visible</em> from the help
message and displayed as if it were just another regular subcommand. If
looking for an alias that will not be displayed in the help message, see
<a href="struct.Command.html#method.alias" title="method clap::Command::alias"><code>Command::alias</code></a>.</p>
<p><strong>NOTE:</strong> When using aliases and checking for the existence of a
particular subcommand within an <a href="struct.ArgMatches.html" title="struct clap::ArgMatches"><code>ArgMatches</code></a> struct, one only needs to
search for the original name and not all aliases.</p>
<h5 id="examples-68"><a class="doc-anchor" href="#examples-68">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.subcommand(Command::new(<span class="string">"test"</span>)
.visible_alias(<span class="string">"do-stuff"</span>))
.get_matches_from(<span class="macro">vec!</span>[<span class="string">"myprog"</span>, <span class="string">"do-stuff"</span>]);
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">"test"</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.visible_short_flag_alias" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#2634">source</a><h4 class="code-header">pub fn <a href="#method.visible_short_flag_alias" class="fn">visible_short_flag_alias</a>(
self,
name: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.char.html">char</a>&gt;
) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Add an alias, which functions as “visible” short flag subcommand</p>
<p>This will automatically dispatch as if this subcommand was used. 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>
<p>See also <a href="struct.Command.html#method.short_flag_alias" title="method clap::Command::short_flag_alias"><code>Command::short_flag_alias</code></a>.</p>
<h5 id="examples-69"><a class="doc-anchor" href="#examples-69">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.subcommand(Command::new(<span class="string">"test"</span>).short_flag(<span class="string">'t'</span>)
.visible_short_flag_alias(<span class="string">'d'</span>))
.get_matches_from(<span class="macro">vec!</span>[<span class="string">"myprog"</span>, <span class="string">"-d"</span>]);
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">"test"</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.visible_long_flag_alias" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#2665">source</a><h4 class="code-header">pub fn <a href="#method.visible_long_flag_alias" class="fn">visible_long_flag_alias</a>(self, name: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Add an alias, which functions as a “visible” long flag subcommand.</p>
<p>This will automatically dispatch as if this subcommand was used. 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>
<p>See also <a href="struct.Command.html#method.long_flag_alias" title="method clap::Command::long_flag_alias"><code>Command::long_flag_alias</code></a>.</p>
<h5 id="examples-70"><a class="doc-anchor" href="#examples-70">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.subcommand(Command::new(<span class="string">"test"</span>).long_flag(<span class="string">"test"</span>)
.visible_long_flag_alias(<span class="string">"testing"</span>))
.get_matches_from(<span class="macro">vec!</span>[<span class="string">"myprog"</span>, <span class="string">"--testing"</span>]);
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">"test"</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/command.rs.html#2703">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.77.2/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.77.2/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;&gt;
) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets multiple visible aliases to this subcommand.</p>
<p>This allows the subcommand to be accessed via <em>either</em> the
original name or any of the given aliases. 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 aliased variants.</p>
<p><strong>NOTE:</strong> The alias defined with this method is <em>visible</em> from the help
message and displayed as if it were just another regular subcommand. If
looking for an alias that will not be displayed in the help message, see
<a href="struct.Command.html#method.alias" title="method clap::Command::alias"><code>Command::alias</code></a>.</p>
<p><strong>NOTE:</strong> When using aliases, and checking for the existence of a
particular subcommand within an <a href="struct.ArgMatches.html" title="struct clap::ArgMatches"><code>ArgMatches</code></a> struct, one only needs to
search for the original name and not all aliases.</p>
<h5 id="examples-71"><a class="doc-anchor" href="#examples-71">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.subcommand(Command::new(<span class="string">"test"</span>)
.visible_aliases([<span class="string">"do-stuff"</span>, <span class="string">"tests"</span>]))
.get_matches_from(<span class="macro">vec!</span>[<span class="string">"myprog"</span>, <span class="string">"do-stuff"</span>]);
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">"test"</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.visible_short_flag_aliases" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#2726">source</a><h4 class="code-header">pub fn <a href="#method.visible_short_flag_aliases" class="fn">visible_short_flag_aliases</a>(
self,
names: impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/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.77.2/std/primitive.char.html">char</a>&gt;
) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Add aliases, which function as <em>visible</em> short flag subcommands.</p>
<p>See <a href="struct.Command.html#method.short_flag_aliases" title="method clap::Command::short_flag_aliases"><code>Command::short_flag_aliases</code></a>.</p>
<h5 id="examples-72"><a class="doc-anchor" href="#examples-72">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.subcommand(Command::new(<span class="string">"test"</span>).short_flag(<span class="string">'b'</span>)
.visible_short_flag_aliases([<span class="string">'t'</span>]))
.get_matches_from(<span class="macro">vec!</span>[<span class="string">"myprog"</span>, <span class="string">"-t"</span>]);
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">"test"</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.visible_long_flag_aliases" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#2751-2754">source</a><h4 class="code-header">pub fn <a href="#method.visible_long_flag_aliases" class="fn">visible_long_flag_aliases</a>(
self,
names: impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/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.77.2/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;&gt;
) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Add aliases, which function as <em>visible</em> long flag subcommands.</p>
<p>See <a href="struct.Command.html#method.long_flag_aliases" title="method clap::Command::long_flag_aliases"><code>Command::long_flag_aliases</code></a>.</p>
<h5 id="examples-73"><a class="doc-anchor" href="#examples-73">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.subcommand(Command::new(<span class="string">"test"</span>).long_flag(<span class="string">"test"</span>)
.visible_long_flag_aliases([<span class="string">"testing"</span>, <span class="string">"testall"</span>, <span class="string">"test_all"</span>]))
.get_matches_from(<span class="macro">vec!</span>[<span class="string">"myprog"</span>, <span class="string">"--testing"</span>]);
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">"test"</span>));</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/command.rs.html#2808">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="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.usize.html">usize</a>&gt;) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Set the placement of this subcommand within the help.</p>
<p>Subcommands with a lower value will be displayed first in the help message.
Those with the same display order will be sorted.</p>
<p><code>Command</code>s are automatically assigned a display order based on the order they are added to
their parent <a href="struct.Command.html" title="struct clap::Command"><code>Command</code></a>.
Overriding this is helpful when the order commands are added in isnt the same as the
display order, whether in one-off cases or to automatically sort commands.</p>
<h5 id="examples-74"><a class="doc-anchor" href="#examples-74">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>m = Command::new(<span class="string">"cust-ord"</span>)
.subcommand(Command::new(<span class="string">"beta"</span>)
.display_order(<span class="number">0</span>) <span class="comment">// Sort
</span>.about(<span class="string">"Some help and text"</span>))
.subcommand(Command::new(<span class="string">"alpha"</span>)
.display_order(<span class="number">0</span>) <span class="comment">// Sort
</span>.about(<span class="string">"I should be first!"</span>))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"cust-ord"</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]
Commands:
alpha I should be first!
beta Some help and text
help Print help for the subcommand(s)
Options:
-h, --help Print help
-V, --version Print version
</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/command.rs.html#2829">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.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Specifies that this <a href="struct.Command.html#method.subcommand" title="method clap::Command::subcommand"><code>subcommand</code></a> should be hidden from help messages</p>
<h5 id="examples-75"><a class="doc-anchor" href="#examples-75">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.subcommand(
Command::new(<span class="string">"test"</span>).hide(<span class="bool-val">true</span>)
)</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.subcommand_required" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#2856">source</a><h4 class="code-header">pub fn <a href="#method.subcommand_required" class="fn">subcommand_required</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>If no <a href="struct.Command.html#method.subcommand" title="method clap::Command::subcommand"><code>subcommand</code></a> is present at runtime, error and exit gracefully.</p>
<h5 id="examples-76"><a class="doc-anchor" href="#examples-76">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>err = Command::new(<span class="string">"myprog"</span>)
.subcommand_required(<span class="bool-val">true</span>)
.subcommand(Command::new(<span class="string">"test"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"myprog"</span>,
]);
<span class="macro">assert!</span>(err.is_err());
<span class="macro">assert_eq!</span>(err.unwrap_err().kind(), ErrorKind::MissingSubcommand);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.allow_external_subcommands" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#2904">source</a><h4 class="code-header">pub fn <a href="#method.allow_external_subcommands" class="fn">allow_external_subcommands</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Assume unexpected positional arguments are a <a href="struct.Command.html#method.subcommand" title="method clap::Command::subcommand"><code>subcommand</code></a>.</p>
<p>Arguments will be stored in the <code>&quot;&quot;</code> argument in the <a href="struct.ArgMatches.html" title="struct clap::ArgMatches"><code>ArgMatches</code></a></p>
<p><strong>NOTE:</strong> Use this setting with caution,
as a truly unexpected argument (i.e. one that is <em>NOT</em> an external subcommand)
will <strong>not</strong> cause an error and instead be treated as a potential subcommand.
One should check for such cases manually and inform the user appropriately.</p>
<p><strong>NOTE:</strong> A built-in subcommand will be parsed as an external subcommand when escaped with
<code>--</code>.</p>
<h5 id="examples-77"><a class="doc-anchor" href="#examples-77">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="comment">// Assume there is an external subcommand named "subcmd"
</span><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.allow_external_subcommands(<span class="bool-val">true</span>)
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"myprog"</span>, <span class="string">"subcmd"</span>, <span class="string">"--option"</span>, <span class="string">"value"</span>, <span class="string">"-fff"</span>, <span class="string">"--flag"
</span>]);
<span class="comment">// All trailing arguments will be stored under the subcommand's sub-matches using an empty
// string argument name
</span><span class="kw">match </span>m.subcommand() {
<span class="prelude-val">Some</span>((external, ext_m)) =&gt; {
<span class="kw">let </span>ext_args: Vec&lt;<span class="kw">_</span>&gt; = ext_m.get_many::&lt;OsString&gt;(<span class="string">""</span>).unwrap().collect();
<span class="macro">assert_eq!</span>(external, <span class="string">"subcmd"</span>);
<span class="macro">assert_eq!</span>(ext_args, [<span class="string">"--option"</span>, <span class="string">"value"</span>, <span class="string">"-fff"</span>, <span class="string">"--flag"</span>]);
},
<span class="kw">_ </span>=&gt; {},
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.external_subcommand_value_parser" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#2971-2974">source</a><h4 class="code-header">pub fn <a href="#method.external_subcommand_value_parser" class="fn">external_subcommand_value_parser</a>(
self,
parser: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.ValueParser.html" title="struct clap::builder::ValueParser">ValueParser</a>&gt;
) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Specifies how to parse external subcommand arguments.</p>
<p>The default parser is for <code>OsString</code>. This can be used to switch it to <code>String</code> or another
type.</p>
<p><strong>NOTE:</strong> Setting this requires <a href="struct.Command.html#method.allow_external_subcommands" title="method clap::Command::allow_external_subcommands"><code>Command::allow_external_subcommands</code></a></p>
<h5 id="examples-78"><a class="doc-anchor" href="#examples-78">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="comment">// Assume there is an external subcommand named "subcmd"
</span><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.allow_external_subcommands(<span class="bool-val">true</span>)
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"myprog"</span>, <span class="string">"subcmd"</span>, <span class="string">"--option"</span>, <span class="string">"value"</span>, <span class="string">"-fff"</span>, <span class="string">"--flag"
</span>]);
<span class="comment">// All trailing arguments will be stored under the subcommand's sub-matches using an empty
// string argument name
</span><span class="kw">match </span>m.subcommand() {
<span class="prelude-val">Some</span>((external, ext_m)) =&gt; {
<span class="kw">let </span>ext_args: Vec&lt;<span class="kw">_</span>&gt; = ext_m.get_many::&lt;OsString&gt;(<span class="string">""</span>).unwrap().collect();
<span class="macro">assert_eq!</span>(external, <span class="string">"subcmd"</span>);
<span class="macro">assert_eq!</span>(ext_args, [<span class="string">"--option"</span>, <span class="string">"value"</span>, <span class="string">"-fff"</span>, <span class="string">"--flag"</span>]);
},
<span class="kw">_ </span>=&gt; {},
}</code></pre></div>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="comment">// Assume there is an external subcommand named "subcmd"
</span><span class="kw">let </span>m = Command::new(<span class="string">"myprog"</span>)
.external_subcommand_value_parser(<span class="macro">value_parser!</span>(String))
.get_matches_from(<span class="macro">vec!</span>[
<span class="string">"myprog"</span>, <span class="string">"subcmd"</span>, <span class="string">"--option"</span>, <span class="string">"value"</span>, <span class="string">"-fff"</span>, <span class="string">"--flag"
</span>]);
<span class="comment">// All trailing arguments will be stored under the subcommand's sub-matches using an empty
// string argument name
</span><span class="kw">match </span>m.subcommand() {
<span class="prelude-val">Some</span>((external, ext_m)) =&gt; {
<span class="kw">let </span>ext_args: Vec&lt;<span class="kw">_</span>&gt; = ext_m.get_many::&lt;String&gt;(<span class="string">""</span>).unwrap().collect();
<span class="macro">assert_eq!</span>(external, <span class="string">"subcmd"</span>);
<span class="macro">assert_eq!</span>(ext_args, [<span class="string">"--option"</span>, <span class="string">"value"</span>, <span class="string">"-fff"</span>, <span class="string">"--flag"</span>]);
},
<span class="kw">_ </span>=&gt; {},
}</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.args_conflicts_with_subcommands" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3002">source</a><h4 class="code-header">pub fn <a href="#method.args_conflicts_with_subcommands" class="fn">args_conflicts_with_subcommands</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Specifies that use of an argument prevents the use of <a href="struct.Command.html#method.subcommand" title="method clap::Command::subcommand"><code>subcommands</code></a>.</p>
<p>By default <code>clap</code> allows arguments between subcommands such
as <code>&lt;cmd&gt; [cmd_args] &lt;subcmd&gt; [subcmd_args] &lt;subsubcmd&gt; [subsubcmd_args]</code>.</p>
<p>This setting disables that functionality and says that arguments can
only follow the <em>final</em> subcommand. For instance using this setting
makes only the following invocations possible:</p>
<ul>
<li><code>&lt;cmd&gt; &lt;subcmd&gt; &lt;subsubcmd&gt; [subsubcmd_args]</code></li>
<li><code>&lt;cmd&gt; &lt;subcmd&gt; [subcmd_args]</code></li>
<li><code>&lt;cmd&gt; [cmd_args]</code></li>
</ul>
<h5 id="examples-79"><a class="doc-anchor" href="#examples-79">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.args_conflicts_with_subcommands(<span class="bool-val">true</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.subcommand_precedence_over_arg" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3062">source</a><h4 class="code-header">pub fn <a href="#method.subcommand_precedence_over_arg" class="fn">subcommand_precedence_over_arg</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Prevent subcommands from being consumed as an arguments value.</p>
<p>By default, if an option taking multiple values is followed by a subcommand, the
subcommand will be parsed as another value.</p>
<div class="example-wrap"><pre class="language-text"><code>cmd --foo val1 val2 subcommand
--------- ----------
values another value
</code></pre></div>
<p>This setting instructs the parser to stop when encountering a subcommand instead of
greedily consuming arguments.</p>
<div class="example-wrap"><pre class="language-text"><code>cmd --foo val1 val2 subcommand
--------- ----------
values subcommand
</code></pre></div><h5 id="examples-80"><a class="doc-anchor" href="#examples-80">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>cmd = Command::new(<span class="string">"cmd"</span>).subcommand(Command::new(<span class="string">"sub"</span>)).arg(
Arg::new(<span class="string">"arg"</span>)
.long(<span class="string">"arg"</span>)
.num_args(<span class="number">1</span>..)
.action(ArgAction::Set),
);
<span class="kw">let </span>matches = cmd
.clone()
.try_get_matches_from(<span class="kw-2">&amp;</span>[<span class="string">"cmd"</span>, <span class="string">"--arg"</span>, <span class="string">"1"</span>, <span class="string">"2"</span>, <span class="string">"3"</span>, <span class="string">"sub"</span>])
.unwrap();
<span class="macro">assert_eq!</span>(
matches.get_many::&lt;String&gt;(<span class="string">"arg"</span>).unwrap().collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;(),
<span class="kw-2">&amp;</span>[<span class="string">"1"</span>, <span class="string">"2"</span>, <span class="string">"3"</span>, <span class="string">"sub"</span>]
);
<span class="macro">assert!</span>(matches.subcommand_matches(<span class="string">"sub"</span>).is_none());
<span class="kw">let </span>matches = cmd
.subcommand_precedence_over_arg(<span class="bool-val">true</span>)
.try_get_matches_from(<span class="kw-2">&amp;</span>[<span class="string">"cmd"</span>, <span class="string">"--arg"</span>, <span class="string">"1"</span>, <span class="string">"2"</span>, <span class="string">"3"</span>, <span class="string">"sub"</span>])
.unwrap();
<span class="macro">assert_eq!</span>(
matches.get_many::&lt;String&gt;(<span class="string">"arg"</span>).unwrap().collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;(),
<span class="kw-2">&amp;</span>[<span class="string">"1"</span>, <span class="string">"2"</span>, <span class="string">"3"</span>]
);
<span class="macro">assert!</span>(matches.subcommand_matches(<span class="string">"sub"</span>).is_some());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.subcommand_negates_reqs" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3117">source</a><h4 class="code-header">pub fn <a href="#method.subcommand_negates_reqs" class="fn">subcommand_negates_reqs</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Allows <a href="struct.Command.html#method.subcommand" title="method clap::Command::subcommand"><code>subcommands</code></a> to override all requirements of the parent command.</p>
<p>For example, if you had a subcommand or top level application with a required argument
that is only required as long as there is no subcommand present,
using this setting would allow you to set those arguments to <a href="struct.Arg.html#method.required" title="method clap::Arg::required"><code>Arg::required(true)</code></a>
and yet receive no error so long as the user uses a valid subcommand instead.</p>
<p><strong>NOTE:</strong> This defaults to false (using subcommand does <em>not</em> negate requirements)</p>
<h5 id="examples-81"><a class="doc-anchor" href="#examples-81">§</a>Examples</h5>
<p>This first example shows that it is an error to not use a required argument</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>err = Command::new(<span class="string">"myprog"</span>)
.subcommand_negates_reqs(<span class="bool-val">true</span>)
.arg(Arg::new(<span class="string">"opt"</span>).required(<span class="bool-val">true</span>))
.subcommand(Command::new(<span class="string">"test"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"myprog"
</span>]);
<span class="macro">assert!</span>(err.is_err());
<span class="macro">assert_eq!</span>(err.unwrap_err().kind(), ErrorKind::MissingRequiredArgument);</code></pre></div>
<p>This next example shows that it is no longer error to not use a required argument if a
valid subcommand is used.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>noerr = Command::new(<span class="string">"myprog"</span>)
.subcommand_negates_reqs(<span class="bool-val">true</span>)
.arg(Arg::new(<span class="string">"opt"</span>).required(<span class="bool-val">true</span>))
.subcommand(Command::new(<span class="string">"test"</span>))
.try_get_matches_from(<span class="macro">vec!</span>[
<span class="string">"myprog"</span>, <span class="string">"test"
</span>]);
<span class="macro">assert!</span>(noerr.is_ok());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.multicall" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3243">source</a><h4 class="code-header">pub fn <a href="#method.multicall" class="fn">multicall</a>(self, yes: <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Multiple-personality program dispatched on the binary name (<code>argv[0]</code>)</p>
<p>A “multicall” executable is a single executable
that contains a variety of applets,
and decides which applet to run based on the name of the file.
The executable can be called from different names by creating hard links
or symbolic links to it.</p>
<p>This is desirable for:</p>
<ul>
<li>Easy distribution, a single binary that can install hardlinks to access the different
personalities.</li>
<li>Minimal binary size by sharing common code (e.g. standard library, clap)</li>
<li>Custom shells or REPLs where there isnt a single top-level command</li>
</ul>
<p>Setting <code>multicall</code> will cause</p>
<ul>
<li><code>argv[0]</code> to be stripped to the base name and parsed as the first argument, as if
<a href="struct.Command.html#method.no_binary_name" title="method clap::Command::no_binary_name"><code>Command::no_binary_name</code></a> was set.</li>
<li>Help and errors to report subcommands as if they were the top-level command</li>
</ul>
<p>When the subcommand is not present, there are several strategies you may employ, depending
on your needs:</p>
<ul>
<li>Let the error percolate up normally</li>
<li>Print a specialized error message using the
<a href="error/struct.Error.html#method.context" title="method clap::error::Error::context"><code>Error::context</code></a></li>
<li>Print the <a href="struct.Command.html#method.write_help" title="method clap::Command::write_help">help</a> but this might be ambiguous</li>
<li>Disable <code>multicall</code> and re-parse it</li>
<li>Disable <code>multicall</code> and re-parse it with a specific subcommand</li>
</ul>
<p>When detecting the error condition, the <a href="error/enum.ErrorKind.html" title="enum clap::error::ErrorKind"><code>ErrorKind</code></a> isnt sufficient as a sub-subcommand
might report the same error. Enable
<a href="struct.Command.html#method.allow_external_subcommands" title="method clap::Command::allow_external_subcommands"><code>allow_external_subcommands</code></a> if you want to specifically
get the unrecognized binary name.</p>
<p><strong>NOTE:</strong> Multicall cant be used with <a href="struct.Command.html#method.no_binary_name" title="method clap::Command::no_binary_name"><code>no_binary_name</code></a> since they interpret
the command name in incompatible ways.</p>
<p><strong>NOTE:</strong> The multicall command cannot have arguments.</p>
<p><strong>NOTE:</strong> Applets are slightly semantically different from subcommands,
so its recommended to use <a href="struct.Command.html#method.subcommand_help_heading" title="method clap::Command::subcommand_help_heading"><code>Command::subcommand_help_heading</code></a> and
<a href="struct.Command.html#method.subcommand_value_name" title="method clap::Command::subcommand_value_name"><code>Command::subcommand_value_name</code></a> to change the descriptive text as above.</p>
<h5 id="examples-82"><a class="doc-anchor" href="#examples-82">§</a>Examples</h5>
<p><code>hostname</code> is an example of a multicall executable.
Both <code>hostname</code> and <code>dnsdomainname</code> are provided by the same executable
and which behaviour to use is based on the executable file name.</p>
<p>This is desirable when the executable has a primary purpose
but there is related functionality that would be convenient to provide
and implement it to be in the same executable.</p>
<p>The name of the cmd is essentially unused
and may be the same as the name of a subcommand.</p>
<p>The names of the immediate subcommands of the Command
are matched against the basename of the first argument,
which is conventionally the path of the executable.</p>
<p>This does not allow the subcommand to be passed as the first non-path argument.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>cmd = Command::new(<span class="string">"hostname"</span>)
.multicall(<span class="bool-val">true</span>)
.subcommand(Command::new(<span class="string">"hostname"</span>))
.subcommand(Command::new(<span class="string">"dnsdomainname"</span>));
<span class="kw">let </span>m = cmd.try_get_matches_from_mut(<span class="kw-2">&amp;</span>[<span class="string">"/usr/bin/hostname"</span>, <span class="string">"dnsdomainname"</span>]);
<span class="macro">assert!</span>(m.is_err());
<span class="macro">assert_eq!</span>(m.unwrap_err().kind(), ErrorKind::UnknownArgument);
<span class="kw">let </span>m = cmd.get_matches_from(<span class="kw-2">&amp;</span>[<span class="string">"/usr/bin/dnsdomainname"</span>]);
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">"dnsdomainname"</span>));</code></pre></div>
<p>Busybox is another common example of a multicall executable
with a subcommmand for each applet that can be run directly,
e.g. with the <code>cat</code> applet being run by running <code>busybox cat</code>,
or with <code>cat</code> as a link to the <code>busybox</code> binary.</p>
<p>This is desirable when the launcher program has additional options
or it is useful to run the applet without installing a symlink
e.g. to test the applet without installing it
or there may already be a command of that name installed.</p>
<p>To make an applet usable as both a multicall link and a subcommand
the subcommands must be defined both in the top-level Command
and as subcommands of the “main” applet.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">fn </span>applet_commands() -&gt; [Command; <span class="number">2</span>] {
[Command::new(<span class="string">"true"</span>), Command::new(<span class="string">"false"</span>)]
}
<span class="kw">let </span><span class="kw-2">mut </span>cmd = Command::new(<span class="string">"busybox"</span>)
.multicall(<span class="bool-val">true</span>)
.subcommand(
Command::new(<span class="string">"busybox"</span>)
.subcommand_value_name(<span class="string">"APPLET"</span>)
.subcommand_help_heading(<span class="string">"APPLETS"</span>)
.subcommands(applet_commands()),
)
.subcommands(applet_commands());
<span class="comment">// When called from the executable's canonical name
// its applets can be matched as subcommands.
</span><span class="kw">let </span>m = cmd.try_get_matches_from_mut(<span class="kw-2">&amp;</span>[<span class="string">"/usr/bin/busybox"</span>, <span class="string">"true"</span>]).unwrap();
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">"busybox"</span>));
<span class="macro">assert_eq!</span>(m.subcommand().unwrap().<span class="number">1</span>.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">"true"</span>));
<span class="comment">// When called from a link named after an applet that applet is matched.
</span><span class="kw">let </span>m = cmd.get_matches_from(<span class="kw-2">&amp;</span>[<span class="string">"/usr/bin/true"</span>]);
<span class="macro">assert_eq!</span>(m.subcommand_name(), <span class="prelude-val">Some</span>(<span class="string">"true"</span>));</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.subcommand_value_name" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3312">source</a><h4 class="code-header">pub fn <a href="#method.subcommand_value_name" class="fn">subcommand_value_name</a>(
self,
value_name: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;
) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets the value name used for subcommands when printing usage and help.</p>
<p>By default, this is “COMMAND”.</p>
<p>See also <a href="struct.Command.html#method.subcommand_help_heading" title="method clap::Command::subcommand_help_heading"><code>Command::subcommand_help_heading</code></a></p>
<h5 id="examples-83"><a class="doc-anchor" href="#examples-83">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.subcommand(Command::new(<span class="string">"sub1"</span>))
.print_help()</code></pre></div>
<p>will produce</p>
<div class="example-wrap"><pre class="language-text"><code>myprog
Usage: myprog [COMMAND]
Commands:
help Print this message or the help of the given subcommand(s)
sub1
Options:
-h, --help Print help
-V, --version Print version
</code></pre></div>
<p>but usage of <code>subcommand_value_name</code></p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.subcommand(Command::new(<span class="string">"sub1"</span>))
.subcommand_value_name(<span class="string">"THING"</span>)
.print_help()</code></pre></div>
<p>will produce</p>
<div class="example-wrap"><pre class="language-text"><code>myprog
Usage: myprog [THING]
Commands:
help Print this message or the help of the given subcommand(s)
sub1
Options:
-h, --help Print help
-V, --version Print version
</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.subcommand_help_heading" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3378">source</a><h4 class="code-header">pub fn <a href="#method.subcommand_help_heading" class="fn">subcommand_help_heading</a>(
self,
heading: impl <a class="trait" href="builder/trait.IntoResettable.html" title="trait clap::builder::IntoResettable">IntoResettable</a>&lt;<a class="struct" href="builder/struct.Str.html" title="struct clap::builder::Str">Str</a>&gt;
) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class="docblock"><p>Sets the help heading used for subcommands when printing usage and help.</p>
<p>By default, this is “Commands”.</p>
<p>See also <a href="struct.Command.html#method.subcommand_value_name" title="method clap::Command::subcommand_value_name"><code>Command::subcommand_value_name</code></a></p>
<h5 id="examples-84"><a class="doc-anchor" href="#examples-84">§</a>Examples</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.subcommand(Command::new(<span class="string">"sub1"</span>))
.print_help()</code></pre></div>
<p>will produce</p>
<div class="example-wrap"><pre class="language-text"><code>myprog
Usage: myprog [COMMAND]
Commands:
help Print this message or the help of the given subcommand(s)
sub1
Options:
-h, --help Print help
-V, --version Print version
</code></pre></div>
<p>but usage of <code>subcommand_help_heading</code></p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>Command::new(<span class="string">"myprog"</span>)
.subcommand(Command::new(<span class="string">"sub1"</span>))
.subcommand_help_heading(<span class="string">"Things"</span>)
.print_help()</code></pre></div>
<p>will produce</p>
<div class="example-wrap"><pre class="language-text"><code>myprog
Usage: myprog [COMMAND]
Things:
help Print this message or the help of the given subcommand(s)
sub1
Options:
-h, --help Print help
-V, --version Print version
</code></pre></div></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Command-4" class="impl"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3385">source</a><a href="#impl-Command-4" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h3></section></summary><div class="docblock"><h4 id="reflection"><a class="doc-anchor" href="#reflection">§</a>Reflection</h4></div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.get_display_name" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3408">source</a><h4 class="code-header">pub fn <a href="#method.get_display_name" class="fn">get_display_name</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>Get the name of the binary.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_bin_name" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3414">source</a><h4 class="code-header">pub fn <a href="#method.get_bin_name" class="fn">get_bin_name</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>Get the name of the binary.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_bin_name" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3425">source</a><h4 class="code-header">pub fn <a href="#method.set_bin_name" class="fn">set_bin_name</a>(&amp;mut self, name: impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.77.2/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;)</h4></section></summary><div class="docblock"><p>Set binary name. Uses <code>&amp;mut self</code> instead of <code>self</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_name" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3431">source</a><h4 class="code-header">pub fn <a href="#method.get_name" class="fn">get_name</a>(&amp;self) -&gt; &amp;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.str.html">str</a></h4></section></summary><div class="docblock"><p>Get the name of the cmd.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_version" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3443">source</a><h4 class="code-header">pub fn <a href="#method.get_version" class="fn">get_version</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>Get the version of the cmd.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_long_version" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3449">source</a><h4 class="code-header">pub fn <a href="#method.get_long_version" class="fn">get_long_version</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>Get the long version of the cmd.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_author" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3455">source</a><h4 class="code-header">pub fn <a href="#method.get_author" class="fn">get_author</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>Get the authors of the cmd.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_short_flag" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3461">source</a><h4 class="code-header">pub fn <a href="#method.get_short_flag" class="fn">get_short_flag</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.char.html">char</a>&gt;</h4></section></summary><div class="docblock"><p>Get the short flag of the subcommand.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_long_flag" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3467">source</a><h4 class="code-header">pub fn <a href="#method.get_long_flag" class="fn">get_long_flag</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>Get the long flag of the subcommand.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_about" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3475">source</a><h4 class="code-header">pub fn <a href="#method.get_about" class="fn">get_about</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;</h4></section></summary><div class="docblock"><p>Get the help message specified via <a href="struct.Command.html#method.about" title="method clap::Command::about"><code>Command::about</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_long_about" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3483">source</a><h4 class="code-header">pub fn <a href="#method.get_long_about" class="fn">get_long_about</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;</h4></section></summary><div class="docblock"><p>Get the help message specified via <a href="struct.Command.html#method.long_about" title="method clap::Command::long_about"><code>Command::long_about</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_flatten_help_set" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3489">source</a><h4 class="code-header">pub fn <a href="#method.is_flatten_help_set" class="fn">is_flatten_help_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Get the custom section heading specified via <a href="struct.Command.html#method.flatten_help" title="method clap::Command::flatten_help"><code>Command::flatten_help</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_next_help_heading" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3497">source</a><h4 class="code-header">pub fn <a href="#method.get_next_help_heading" class="fn">get_next_help_heading</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>Get the custom section heading specified via <a href="struct.Command.html#method.next_help_heading" title="method clap::Command::next_help_heading"><code>Command::next_help_heading</code></a>.</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/command.rs.html#3503">source</a><h4 class="code-header">pub fn <a href="#method.get_visible_aliases" class="fn">get_visible_aliases</a>(&amp;self) -&gt; impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = &amp;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>Iterate through the <em>visible</em> aliases for this subcommand.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_visible_short_flag_aliases" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3512">source</a><h4 class="code-header">pub fn <a href="#method.get_visible_short_flag_aliases" class="fn">get_visible_short_flag_aliases</a>(&amp;self) -&gt; impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.char.html">char</a>&gt;</h4></section></summary><div class="docblock"><p>Iterate through the <em>visible</em> short aliases for this subcommand.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_visible_long_flag_aliases" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3521">source</a><h4 class="code-header">pub fn <a href="#method.get_visible_long_flag_aliases" class="fn">get_visible_long_flag_aliases</a>(&amp;self) -&gt; impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = &amp;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>Iterate through the <em>visible</em> long aliases for this subcommand.</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/command.rs.html#3530">source</a><h4 class="code-header">pub fn <a href="#method.get_all_aliases" class="fn">get_all_aliases</a>(&amp;self) -&gt; impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = &amp;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>Iterate through the set of <em>all</em> the aliases for this subcommand, both visible and hidden.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_all_short_flag_aliases" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3536">source</a><h4 class="code-header">pub fn <a href="#method.get_all_short_flag_aliases" class="fn">get_all_short_flag_aliases</a>(&amp;self) -&gt; impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.char.html">char</a>&gt;</h4></section></summary><div class="docblock"><p>Iterate through the set of <em>all</em> the short aliases for this subcommand, both visible and hidden.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_all_long_flag_aliases" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3542">source</a><h4 class="code-header">pub fn <a href="#method.get_all_long_flag_aliases" class="fn">get_all_long_flag_aliases</a>(&amp;self) -&gt; impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = &amp;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>Iterate through the set of <em>all</em> the long aliases for this subcommand, both visible and hidden.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_color" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3552">source</a><h4 class="code-header">pub fn <a href="#method.get_color" class="fn">get_color</a>(&amp;self) -&gt; <a class="enum" href="enum.ColorChoice.html" title="enum clap::ColorChoice">ColorChoice</a></h4></section></summary><div class="docblock"><p>Should we color the output?</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_styles" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3573">source</a><h4 class="code-header">pub fn <a href="#method.get_styles" class="fn">get_styles</a>(&amp;self) -&gt; &amp;<a class="struct" href="builder/struct.Styles.html" title="struct clap::builder::Styles">Styles</a></h4></section></summary><div class="docblock"><p>Return the current <code>Styles</code> for the <code>Command</code></p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_subcommands" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3579">source</a><h4 class="code-header">pub fn <a href="#method.get_subcommands" class="fn">get_subcommands</a>(&amp;self) -&gt; impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = &amp;<a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a>&gt;</h4></section></summary><div class="docblock"><p>Iterate through the set of subcommands, getting a reference to each.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_subcommands_mut" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3585">source</a><h4 class="code-header">pub fn <a href="#method.get_subcommands_mut" class="fn">get_subcommands_mut</a>(&amp;mut self) -&gt; impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = &amp;mut <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a>&gt;</h4></section></summary><div class="docblock"><p>Iterate through the set of subcommands, getting a mutable reference to each.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.has_subcommands" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3591">source</a><h4 class="code-header">pub fn <a href="#method.has_subcommands" class="fn">has_subcommands</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns <code>true</code> if this <code>Command</code> has subcommands.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_subcommand_help_heading" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3597">source</a><h4 class="code-header">pub fn <a href="#method.get_subcommand_help_heading" class="fn">get_subcommand_help_heading</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>Returns the help heading for listing subcommands.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_subcommand_value_name" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3603">source</a><h4 class="code-header">pub fn <a href="#method.get_subcommand_value_name" class="fn">get_subcommand_value_name</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>Returns the subcommand value name.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_before_help" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3609">source</a><h4 class="code-header">pub fn <a href="#method.get_before_help" class="fn">get_before_help</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;</h4></section></summary><div class="docblock"><p>Returns the help heading for listing subcommands.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_before_long_help" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3615">source</a><h4 class="code-header">pub fn <a href="#method.get_before_long_help" class="fn">get_before_long_help</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;</h4></section></summary><div class="docblock"><p>Returns the help heading for listing subcommands.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_after_help" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3621">source</a><h4 class="code-header">pub fn <a href="#method.get_after_help" class="fn">get_after_help</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;</h4></section></summary><div class="docblock"><p>Returns the help heading for listing subcommands.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_after_long_help" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3627">source</a><h4 class="code-header">pub fn <a href="#method.get_after_long_help" class="fn">get_after_long_help</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="builder/struct.StyledStr.html" title="struct clap::builder::StyledStr">StyledStr</a>&gt;</h4></section></summary><div class="docblock"><p>Returns the help heading for listing subcommands.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.find_subcommand" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3635">source</a><h4 class="code-header">pub fn <a href="#method.find_subcommand" class="fn">find_subcommand</a>(&amp;self, name: impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.77.2/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a>&gt;</h4></section></summary><div class="docblock"><p>Find subcommand such that its name or one of aliases equals <code>name</code>.</p>
<p>This does not recurse through subcommands of subcommands.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.find_subcommand_mut" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3645-3648">source</a><h4 class="code-header">pub fn <a href="#method.find_subcommand_mut" class="fn">find_subcommand_mut</a>(
&amp;mut self,
name: impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.77.2/std/ffi/os_str/struct.OsStr.html" title="struct std::ffi::os_str::OsStr">OsStr</a>&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;mut <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a>&gt;</h4></section></summary><div class="docblock"><p>Find subcommand such that its name or one of aliases equals <code>name</code>, returning
a mutable reference to the subcommand.</p>
<p>This does not recurse through subcommands of subcommands.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_groups" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3655">source</a><h4 class="code-header">pub fn <a href="#method.get_groups" class="fn">get_groups</a>(&amp;self) -&gt; impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = &amp;<a class="struct" href="struct.ArgGroup.html" title="struct clap::ArgGroup">ArgGroup</a>&gt;</h4></section></summary><div class="docblock"><p>Iterate through the set of groups.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_arguments" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3661">source</a><h4 class="code-header">pub fn <a href="#method.get_arguments" class="fn">get_arguments</a>(&amp;self) -&gt; impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = &amp;<a class="struct" href="struct.Arg.html" title="struct clap::Arg">Arg</a>&gt;</h4></section></summary><div class="docblock"><p>Iterate through the set of arguments.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_positionals" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3667">source</a><h4 class="code-header">pub fn <a href="#method.get_positionals" class="fn">get_positionals</a>(&amp;self) -&gt; impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = &amp;<a class="struct" href="struct.Arg.html" title="struct clap::Arg">Arg</a>&gt;</h4></section></summary><div class="docblock"><p>Iterate through the <em>positionals</em> arguments.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_opts" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3672">source</a><h4 class="code-header">pub fn <a href="#method.get_opts" class="fn">get_opts</a>(&amp;self) -&gt; impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = &amp;<a class="struct" href="struct.Arg.html" title="struct clap::Arg">Arg</a>&gt;</h4></section></summary><div class="docblock"><p>Iterate through the <em>options</em>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_arg_conflicts_with" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3686">source</a><h4 class="code-header">pub fn <a href="#method.get_arg_conflicts_with" class="fn">get_arg_conflicts_with</a>(&amp;self, arg: &amp;<a class="struct" href="struct.Arg.html" title="struct clap::Arg">Arg</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.77.2/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;&amp;<a class="struct" href="struct.Arg.html" title="struct clap::Arg">Arg</a>&gt;</h4></section></summary><div class="docblock"><p>Get a list of all arguments the given argument conflicts with.</p>
<p>If the provided argument is declared as global, the conflicts will be determined
based on the propagation rules of global arguments.</p>
<h6 id="panics-10"><a class="doc-anchor" href="#panics-10">§</a>Panics</h6>
<p>If the given arg contains a conflict with an argument that is unknown to
this <code>Command</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_no_binary_name_set" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3768">source</a><h4 class="code-header">pub fn <a href="#method.is_no_binary_name_set" class="fn">is_no_binary_name_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="struct.Command.html#method.no_binary_name" title="method clap::Command::no_binary_name"><code>Command::no_binary_name</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_dont_delimit_trailing_values_set" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3778">source</a><h4 class="code-header">pub fn <a href="#method.is_dont_delimit_trailing_values_set" class="fn">is_dont_delimit_trailing_values_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="struct.Command.html#method.dont_delimit_trailing_values" title="method clap::Command::dont_delimit_trailing_values"><code>Command::dont_delimit_trailing_values</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_disable_version_flag_set" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3783">source</a><h4 class="code-header">pub fn <a href="#method.is_disable_version_flag_set" class="fn">is_disable_version_flag_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="struct.Command.html#method.disable_version_flag" title="method clap::Command::disable_version_flag"><code>Command::disable_version_flag</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_propagate_version_set" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3789">source</a><h4 class="code-header">pub fn <a href="#method.is_propagate_version_set" class="fn">is_propagate_version_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="struct.Command.html#method.propagate_version" title="method clap::Command::propagate_version"><code>Command::propagate_version</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/command.rs.html#3794">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.77.2/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="struct.Command.html#method.next_line_help" title="method clap::Command::next_line_help"><code>Command::next_line_help</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_disable_help_flag_set" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3799">source</a><h4 class="code-header">pub fn <a href="#method.is_disable_help_flag_set" class="fn">is_disable_help_flag_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="struct.Command.html#method.disable_help_flag" title="method clap::Command::disable_help_flag"><code>Command::disable_help_flag</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_disable_help_subcommand_set" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3804">source</a><h4 class="code-header">pub fn <a href="#method.is_disable_help_subcommand_set" class="fn">is_disable_help_subcommand_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="struct.Command.html#method.disable_help_subcommand" title="method clap::Command::disable_help_subcommand"><code>Command::disable_help_subcommand</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_disable_colored_help_set" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3809">source</a><h4 class="code-header">pub fn <a href="#method.is_disable_colored_help_set" class="fn">is_disable_colored_help_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="struct.Command.html#method.disable_colored_help" title="method clap::Command::disable_colored_help"><code>Command::disable_colored_help</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_arg_required_else_help_set" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3839">source</a><h4 class="code-header">pub fn <a href="#method.is_arg_required_else_help_set" class="fn">is_arg_required_else_help_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="struct.Command.html#method.arg_required_else_help" title="method clap::Command::arg_required_else_help"><code>Command::arg_required_else_help</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_allow_missing_positional_set" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3877">source</a><h4 class="code-header">pub fn <a href="#method.is_allow_missing_positional_set" class="fn">is_allow_missing_positional_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="struct.Command.html#method.allow_missing_positional" title="method clap::Command::allow_missing_positional"><code>Command::allow_missing_positional</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/command.rs.html#3882">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.77.2/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="struct.Command.html#method.hide" title="method clap::Command::hide"><code>Command::hide</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_subcommand_required_set" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3887">source</a><h4 class="code-header">pub fn <a href="#method.is_subcommand_required_set" class="fn">is_subcommand_required_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="struct.Command.html#method.subcommand_required" title="method clap::Command::subcommand_required"><code>Command::subcommand_required</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_allow_external_subcommands_set" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3892">source</a><h4 class="code-header">pub fn <a href="#method.is_allow_external_subcommands_set" class="fn">is_allow_external_subcommands_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="struct.Command.html#method.allow_external_subcommands" title="method clap::Command::allow_external_subcommands"><code>Command::allow_external_subcommands</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_external_subcommand_value_parser" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3907">source</a><h4 class="code-header">pub fn <a href="#method.get_external_subcommand_value_parser" class="fn">get_external_subcommand_value_parser</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.77.2/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;<a class="struct" href="builder/struct.ValueParser.html" title="struct clap::builder::ValueParser">ValueParser</a>&gt;</h4></section></summary><div class="docblock"><p>Configured parser for values passed to an external subcommand</p>
<h5 id="example"><a class="doc-anchor" href="#example">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>cmd = clap::Command::new(<span class="string">"raw"</span>)
.external_subcommand_value_parser(<span class="macro">clap::value_parser!</span>(String));
<span class="kw">let </span>value_parser = cmd.get_external_subcommand_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_args_conflicts_with_subcommands_set" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3917">source</a><h4 class="code-header">pub fn <a href="#method.is_args_conflicts_with_subcommands_set" class="fn">is_args_conflicts_with_subcommands_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="struct.Command.html#method.args_conflicts_with_subcommands" title="method clap::Command::args_conflicts_with_subcommands"><code>Command::args_conflicts_with_subcommands</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_subcommand_precedence_over_arg_set" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3927">source</a><h4 class="code-header">pub fn <a href="#method.is_subcommand_precedence_over_arg_set" class="fn">is_subcommand_precedence_over_arg_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="struct.Command.html#method.subcommand_precedence_over_arg" title="method clap::Command::subcommand_precedence_over_arg"><code>Command::subcommand_precedence_over_arg</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_subcommand_negates_reqs_set" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3932">source</a><h4 class="code-header">pub fn <a href="#method.is_subcommand_negates_reqs_set" class="fn">is_subcommand_negates_reqs_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="struct.Command.html#method.subcommand_negates_reqs" title="method clap::Command::subcommand_negates_reqs"><code>Command::subcommand_negates_reqs</code></a> is set</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_multicall_set" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3937">source</a><h4 class="code-header">pub fn <a href="#method.is_multicall_set" class="fn">is_multicall_set</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Report whether <a href="struct.Command.html#method.multicall" title="method clap::Command::multicall"><code>Command::multicall</code></a> is set</p>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Command-5" class="impl"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#3943">source</a><a href="#impl-Command-5" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.build" class="method"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#4020">source</a><h4 class="code-header">pub fn <a href="#method.build" class="fn">build</a>(&amp;mut self)</h4></section></summary><div class="docblock"><p>Prepare for introspecting on all included <a href="struct.Command.html" title="struct clap::Command"><code>Command</code></a>s</p>
<p>Call this on the top-level <a href="struct.Command.html" title="struct clap::Command"><code>Command</code></a> when done building and before reading state for
cases like completions, custom help output, etc.</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-Command" class="impl"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#72">source</a><a href="#impl-Clone-for-Command" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</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/command.rs.html#72">source</a><a href="#method.clone" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.2/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&amp;self) -&gt; <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</a></h4></section></summary><div class='docblock'>Returns a copy of the value. <a href="https://doc.rust-lang.org/1.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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-Command" class="impl"><a class="src rightside" href="../src/clap_builder/builder/command.rs.html#72">source</a><a href="#impl-Debug-for-Command" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.77.2/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Command.html" title="struct clap::Command">Command</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/command.rs.html#72">source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.2/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.77.2/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.77.2/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.77.2/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.77.2/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.77.2/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-Command" class="impl"><a class="src rightside" href="../src/clap_
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/src/core/convert/mod.rs.html#764">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.77.2/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.77.2/src/core/convert/mod.rs.html#767">source</a><a href="#method.from-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.2/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.77.2/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.77.2/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.77.2/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.77.2/src/core/convert/mod.rs.html#757">source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.77.2/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.77.2/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.77.2/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.77.2/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.77.2/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.77.2/src/core/convert/mod.rs.html#804-806">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.77.2/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.77.2/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-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.77.2/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.77.2/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.77.2/src/core/convert/mod.rs.html#811">source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.2/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.77.2/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.77.2/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.77.2/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.77.2/src/core/convert/mod.rs.html#789-791">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.77.2/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.77.2/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" class="associatedtype trait-impl"><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.77.2/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.77.2/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.77.2/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.77.2/src/core/convert/mod.rs.html#796">source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.77.2/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.77.2/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.77.2/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.77.2/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>