forked from extern/nushell
Track call arguments in a single list (#5125)
* Initial implementation of ordered call args * Run cargo fmt * Fix some clippy lints * Add positional len and nth * Cargo fmt * Remove more old nth calls * Good ole rustfmt * Add named len Co-authored-by: Hristo Filaretov <h.filaretov@protonmail.com>
This commit is contained in:
@ -245,7 +245,10 @@ impl Command for Char {
|
||||
}
|
||||
let mut multi_byte = String::new();
|
||||
for (i, arg) in args.iter().enumerate() {
|
||||
let span = call.nth(i).expect("Unexpected missing argument").span;
|
||||
let span = call
|
||||
.positional_nth(i)
|
||||
.expect("Unexpected missing argument")
|
||||
.span;
|
||||
multi_byte.push(string_to_unicode_char(arg, &span)?)
|
||||
}
|
||||
Ok(Value::string(multi_byte, call_span).into_pipeline_data())
|
||||
@ -262,7 +265,9 @@ impl Command for Char {
|
||||
} else {
|
||||
Err(ShellError::UnsupportedInput(
|
||||
"error finding named character".into(),
|
||||
call.nth(0).expect("Unexpected missing argument").span,
|
||||
call.positional_nth(0)
|
||||
.expect("Unexpected missing argument")
|
||||
.span,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user