mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 18:57:44 +02:00
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:
@ -380,7 +380,9 @@ Format: #
|
||||
None => {
|
||||
return Err(ShellError::UnsupportedInput(
|
||||
String::from("Unknown ansi code"),
|
||||
call.nth(0).expect("Unexpected missing argument").span,
|
||||
call.positional_nth(0)
|
||||
.expect("Unexpected missing argument")
|
||||
.span,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
@ -57,15 +57,14 @@ impl Command for KeybindingsList {
|
||||
call: &Call,
|
||||
_input: PipelineData,
|
||||
) -> Result<nu_protocol::PipelineData, nu_protocol::ShellError> {
|
||||
let records = if call.named.is_empty() {
|
||||
let records = if call.named_len() == 0 {
|
||||
let all_options = vec!["modifiers", "keycodes", "edits", "modes", "events"];
|
||||
all_options
|
||||
.iter()
|
||||
.flat_map(|argument| get_records(argument, &call.head))
|
||||
.collect()
|
||||
} else {
|
||||
call.named
|
||||
.iter()
|
||||
call.named_iter()
|
||||
.flat_map(|(argument, _)| get_records(argument.item.as_str(), &call.head))
|
||||
.collect()
|
||||
};
|
||||
|
Reference in New Issue
Block a user