forked from extern/nushell
Fix inc plugin
This commit is contained in:
parent
3ebb6ba991
commit
c7abb31b7c
@ -32,6 +32,14 @@ impl PositionalType {
|
|||||||
PositionalType::Mandatory(name.to_string(), SyntaxType::Any)
|
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 {
|
pub fn mandatory_block(name: &str) -> PositionalType {
|
||||||
PositionalType::Mandatory(name.to_string(), SyntaxType::Block)
|
PositionalType::Mandatory(name.to_string(), SyntaxType::Block)
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ impl Plugin for Inc {
|
|||||||
fn config(&mut self) -> Result<CommandConfig, ShellError> {
|
fn config(&mut self) -> Result<CommandConfig, ShellError> {
|
||||||
Ok(CommandConfig {
|
Ok(CommandConfig {
|
||||||
name: "inc".to_string(),
|
name: "inc".to_string(),
|
||||||
positional: vec![PositionalType::mandatory_any("Increment")],
|
positional: vec![PositionalType::optional_any("Increment")],
|
||||||
is_filter: true,
|
is_filter: true,
|
||||||
is_sink: false,
|
is_sink: false,
|
||||||
named: IndexMap::new(),
|
named: IndexMap::new(),
|
||||||
|
Loading…
Reference in New Issue
Block a user