mirror of
https://github.com/nushell/nushell
synced 2024-12-27 05:23:11 +00:00
Allow for and other commands missing positionals near keywords (#606)
* Allow for and other commands missing positionals near keywords * A bit more resilience
This commit is contained in:
parent
5c94528fe2
commit
384ea111eb
2 changed files with 16 additions and 0 deletions
|
@ -596,6 +596,17 @@ pub fn parse_internal_call(
|
|||
// spans_idx, end, positional_idx
|
||||
// );
|
||||
|
||||
if spans[..end].is_empty() {
|
||||
error = error.or_else(|| {
|
||||
Some(ParseError::MissingPositional(
|
||||
positional.name.clone(),
|
||||
spans[spans_idx],
|
||||
))
|
||||
});
|
||||
positional_idx += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
let orig_idx = spans_idx;
|
||||
let (arg, err) = parse_multispan_value(
|
||||
working_set,
|
||||
|
|
|
@ -118,3 +118,8 @@ fn long_flag() -> TestResult {
|
|||
fn let_not_statement() -> TestResult {
|
||||
fail_test(r#"let x = "hello" | str length"#, "can't")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn for_in_missing_var_name() -> TestResult {
|
||||
fail_test("for in", "missing")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue