diff --git a/crates/nu-cli/src/commands/keybindings_listen.rs b/crates/nu-cli/src/commands/keybindings_listen.rs index cdda374ae..96d8f4f32 100644 --- a/crates/nu-cli/src/commands/keybindings_listen.rs +++ b/crates/nu-cli/src/commands/keybindings_listen.rs @@ -20,6 +20,10 @@ impl Command for KeybindingsListen { "Get input from the user." } + fn extra_usage(&self) -> &str { + "This is an internal debugging tool. For better output, try `input listen --types [key]`" + } + fn signature(&self) -> Signature { Signature::build(self.name()) .category(Category::Platform) diff --git a/crates/nu-command/src/platform/input/input_listen.rs b/crates/nu-command/src/platform/input/input_listen.rs index f0ad136c5..7ed6b31a1 100644 --- a/crates/nu-command/src/platform/input/input_listen.rs +++ b/crates/nu-command/src/platform/input/input_listen.rs @@ -7,8 +7,8 @@ use nu_engine::CallExt; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ - record, Category, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape, - Type, Value, + record, Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, + SyntaxShape, Type, Value, }; use num_traits::AsPrimitive; use std::io::stdout; @@ -69,7 +69,13 @@ There are 4 `key_type` variants: media - dedicated media keys (play, pause, tracknext ...) other - keys not falling under previous categories (up, down, backspace, enter ...)"# } - + fn examples(&self) -> Vec { + vec![Example { + description: "Listen for a keyboard shortcut and find out how nu receives it", + example: "input listen --types [key]", + result: None, + }] + } fn run( &self, engine_state: &EngineState,