pub struct SpecArg {Show 15 fields
pub name: String,
pub usage: String,
pub help: Option<String>,
pub help_long: Option<String>,
pub help_md: Option<String>,
pub help_first_line: Option<String>,
pub required: bool,
pub double_dash: SpecDoubleDashChoices,
pub var: bool,
pub var_min: Option<usize>,
pub var_max: Option<usize>,
pub hide: bool,
pub default: Vec<String>,
pub choices: Option<SpecChoices>,
pub env: Option<String>,
}Expand description
A positional argument specification.
Arguments are positional values passed to a command without a flag prefix. They can be required or optional, and can accept multiple values (variadic).
§Example
use usage::SpecArg;
let arg = SpecArg::builder()
.name("file")
.required(true)
.help("Input file to process")
.build();Fields§
§name: StringName of the argument (used in help text)
usage: StringGenerated usage string (e.g., “
help: Option<String>Short help text shown in command listings
help_long: Option<String>Extended help text shown with –help
help_md: Option<String>Markdown-formatted help text
help_first_line: Option<String>First line of help text (auto-generated)
required: boolWhether this argument must be provided
double_dash: SpecDoubleDashChoicesHow to handle the “–” separator
var: boolWhether this argument accepts multiple values
var_min: Option<usize>Minimum number of values for variadic arguments
var_max: Option<usize>Maximum number of values for variadic arguments
hide: boolWhether to hide this argument from help output
default: Vec<String>Default value(s) if the argument is not provided
choices: Option<SpecChoices>Valid choices for this argument
env: Option<String>Environment variable that can provide this argument’s value
Implementations§
Trait Implementations§
impl Eq for SpecArg
Auto Trait Implementations§
impl Freeze for SpecArg
impl RefUnwindSafe for SpecArg
impl Send for SpecArg
impl Sync for SpecArg
impl Unpin for SpecArg
impl UnwindSafe for SpecArg
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more