mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 22:32:33 +00:00
feat: name API
This commit is contained in:
parent
d159a3c2a4
commit
fb917072f5
1 changed files with 11 additions and 0 deletions
|
@ -623,6 +623,17 @@ impl<'help> Arg<'help> {
|
|||
self
|
||||
}
|
||||
|
||||
/// Set the identifier used for referencing this argument in the clap API.
|
||||
///
|
||||
/// **NOTE:** This will shown to the user in usage/help if no [`value_name`](Arg::value_name]
|
||||
/// is provided.
|
||||
pub fn name<S: Into<&'help str>>(mut self, n: S) -> Self {
|
||||
let name = n.into();
|
||||
self.id = Id::from(&*name);
|
||||
self.name = name;
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the short version of the argument without the preceding `-`.
|
||||
///
|
||||
/// By default `clap` automatically assigns `V` and `h` to the auto-generated `version` and
|
||||
|
|
Loading…
Reference in a new issue