Fix the for loop to create vars

This commit is contained in:
JT
2021-10-10 05:10:46 +13:00
parent 9a3b0312d2
commit e4ce41ba15
6 changed files with 23 additions and 134 deletions

View File

@ -36,6 +36,7 @@ pub struct Signature {
pub rest_positional: Option<PositionalArg>,
pub named: Vec<Flag>,
pub is_filter: bool,
pub creates_scope: bool,
}
impl PartialEq for Signature {
@ -62,6 +63,7 @@ impl Signature {
rest_positional: None,
named: vec![],
is_filter: false,
creates_scope: false,
}
}
pub fn build(name: impl Into<String>) -> Signature {
@ -189,6 +191,12 @@ impl Signature {
self
}
/// Sets that signature will create a scope as it parses
pub fn creates_scope(mut self) -> Signature {
self.creates_scope = true;
self
}
/// Get list of the short-hand flags
pub fn get_shorts(&self) -> Vec<char> {
self.named.iter().filter_map(|f| f.short).collect()