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:
4
crates/nu-command/src/env/let_env.rs
vendored
4
crates/nu-command/src/env/let_env.rs
vendored
@@ -35,7 +35,9 @@ impl Command for LetEnv {
|
||||
) -> Result<nu_protocol::PipelineData, nu_protocol::ShellError> {
|
||||
let env_var = call.req(engine_state, stack, 0)?;
|
||||
|
||||
let keyword_expr = call.positional[1]
|
||||
let keyword_expr = call
|
||||
.positional_nth(1)
|
||||
.expect("checked through parser")
|
||||
.as_keyword()
|
||||
.expect("internal error: missing keyword");
|
||||
|
||||
|
8
crates/nu-command/src/env/with_env.rs
vendored
8
crates/nu-command/src/env/with_env.rs
vendored
@@ -99,7 +99,9 @@ fn with_env(
|
||||
return Err(ShellError::CantConvert(
|
||||
"string list or single row".into(),
|
||||
x.get_type().to_string(),
|
||||
call.positional[1].span,
|
||||
call.positional_nth(1)
|
||||
.expect("already checked through .req")
|
||||
.span,
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -123,7 +125,9 @@ fn with_env(
|
||||
return Err(ShellError::CantConvert(
|
||||
"string list or single row".into(),
|
||||
x.get_type().to_string(),
|
||||
call.positional[1].span,
|
||||
call.positional_nth(1)
|
||||
.expect("already checked through .req")
|
||||
.span,
|
||||
));
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user