diff --git a/crates/nu-cli/src/commands/keybindings_list.rs b/crates/nu-cli/src/commands/keybindings_list.rs index 350df7b820..abb5909a97 100644 --- a/crates/nu-cli/src/commands/keybindings_list.rs +++ b/crates/nu-cli/src/commands/keybindings_list.rs @@ -61,10 +61,12 @@ impl Command for KeybindingsList { .map(|option| call.has_flag(engine_state, stack, option)) .collect::, 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(); diff --git a/crates/nu-cli/tests/commands/keybindings_list.rs b/crates/nu-cli/tests/commands/keybindings_list.rs new file mode 100644 index 0000000000..4ab9f3bacf --- /dev/null +++ b/crates/nu-cli/tests/commands/keybindings_list.rs @@ -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"); +} diff --git a/crates/nu-cli/tests/commands/mod.rs b/crates/nu-cli/tests/commands/mod.rs index 00488f0b9e..087791302e 100644 --- a/crates/nu-cli/tests/commands/mod.rs +++ b/crates/nu-cli/tests/commands/mod.rs @@ -1 +1,2 @@ +mod keybindings_list; mod nu_highlight;