mirror of
https://github.com/nushell/nushell
synced 2025-01-14 14:14:13 +00:00
Fix keybindings list
being empty by default (#13456)
# Description Made a mistake when fixing this for IR. The default behavior with no options set is to list everything. Restored that. This should go in the 0.96.1 patch release. # Tests + Formatting Added regression test.
This commit is contained in:
parent
e68f744dda
commit
53fbf62493
3 changed files with 11 additions and 1 deletions
|
@ -61,10 +61,12 @@ impl Command for KeybindingsList {
|
||||||
.map(|option| call.has_flag(engine_state, stack, option))
|
.map(|option| call.has_flag(engine_state, stack, option))
|
||||||
.collect::<Result<Vec<_>, ShellError>>()?;
|
.collect::<Result<Vec<_>, ShellError>>()?;
|
||||||
|
|
||||||
|
let no_option_specified = presence.iter().all(|present| !*present);
|
||||||
|
|
||||||
let records = all_options
|
let records = all_options
|
||||||
.iter()
|
.iter()
|
||||||
.zip(presence)
|
.zip(presence)
|
||||||
.filter(|(_, present)| *present)
|
.filter(|(_, present)| no_option_specified || *present)
|
||||||
.flat_map(|(option, _)| get_records(option, call.head))
|
.flat_map(|(option, _)| get_records(option, call.head))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
|
7
crates/nu-cli/tests/commands/keybindings_list.rs
Normal file
7
crates/nu-cli/tests/commands/keybindings_list.rs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
use nu_test_support::nu;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn not_empty() {
|
||||||
|
let result = nu!("keybindings list | is-not-empty");
|
||||||
|
assert_eq!(result.out, "true");
|
||||||
|
}
|
|
@ -1 +1,2 @@
|
||||||
|
mod keybindings_list;
|
||||||
mod nu_highlight;
|
mod nu_highlight;
|
||||||
|
|
Loading…
Reference in a new issue