Fix keybindings list being empty by default

This commit is contained in:
Devyn Cairns 2024-07-25 12:50:38 -07:00
parent e2d0514bb5
commit 6008b8f860
No known key found for this signature in database
3 changed files with 11 additions and 1 deletions

View File

@ -61,10 +61,12 @@ impl Command for KeybindingsList {
.map(|option| call.has_flag(engine_state, stack, option))
.collect::<Result<Vec<_>, ShellError>>()?;
let no_option_specified = presence.iter().all(|present| !*present);
let records = all_options
.iter()
.zip(presence)
.filter(|(_, present)| *present)
.filter(|(_, present)| no_option_specified || *present)
.flat_map(|(option, _)| get_records(option, call.head))
.collect();

View 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");
}

View File

@ -1 +1,2 @@
mod keybindings_list;
mod nu_highlight;