pub struct Parameter<'a> { /* private fields */ }
Expand description
Description of a parameter to be added to the Command
.
The lifetime parameter 'a
refers to the lifetime
of the strings used for parameter names, aliases and
help text.
Implementations§
Source§impl<'a> Parameter<'a>
impl<'a> Parameter<'a>
Mark the parameter as hidden. Hidden parameters will match within the parser, but are not listed during completion.
Sourcepub fn priority(self, priority: i32) -> Self
pub fn priority(self, priority: i32) -> Self
Give the parameter a priority. This is used when sorting out conflicts during matching and completion.
The priority
of a Parameter
defaults to PRIORITY_PARAMETER
except for when the kind
is ParameterKind::Flag
in which
case, the default will be PRIORITY_DEFAULT
.
This is not commonly needed.
Sourcepub fn repeatable(self, repeatable: bool) -> Self
pub fn repeatable(self, repeatable: bool) -> Self
Establish whether or not this parameter is repeatable. Repeated parameters produce a vector of values and can be given multiple times within a single command invocation.
Sourcepub fn alias(self, alias: &'a str) -> Self
pub fn alias(self, alias: &'a str) -> Self
Add an alias that this parameter can use.
Aliases are currently only valid for parameters of kind
ParameterKind::Named
.
Sourcepub fn required(self, required: bool) -> Self
pub fn required(self, required: bool) -> Self
Establish whether or not this parameter is required.
Sourcepub fn kind(self, kind: ParameterKind) -> Self
pub fn kind(self, kind: ParameterKind) -> Self
Set which type of ParameterNode
is supposed to be created
to represent this parameter.