Fix inc plugin

This commit is contained in:
Jonathan Turner 2019-07-16 19:25:48 +12:00
parent 3ebb6ba991
commit c7abb31b7c
2 changed files with 9 additions and 1 deletions

View File

@ -32,6 +32,14 @@ impl PositionalType {
PositionalType::Mandatory(name.to_string(), SyntaxType::Any)
}
pub fn optional(name: &str, ty: SyntaxType) -> PositionalType {
PositionalType::Optional(name.to_string(), ty)
}
pub fn optional_any(name: &str) -> PositionalType {
PositionalType::Optional(name.to_string(), SyntaxType::Any)
}
pub fn mandatory_block(name: &str) -> PositionalType {
PositionalType::Mandatory(name.to_string(), SyntaxType::Block)
}

View File

@ -17,7 +17,7 @@ impl Plugin for Inc {
fn config(&mut self) -> Result<CommandConfig, ShellError> {
Ok(CommandConfig {
name: "inc".to_string(),
positional: vec![PositionalType::mandatory_any("Increment")],
positional: vec![PositionalType::optional_any("Increment")],
is_filter: true,
is_sink: false,
named: IndexMap::new(),