From 71ced35987d9514cfa240e24c1f472cb2685e6b0 Mon Sep 17 00:00:00 2001 From: Jack Wright <56345+ayax79@users.noreply.github.com> Date: Tue, 27 Aug 2024 16:58:05 -0700 Subject: [PATCH] Changed category for `panic` and added search terms and examples (#13707) # Description Cosmetic changes around `panic` command. Changed category, added search terms, and examples. # User-Facing Changes See above --- crates/nu-command/src/misc/panic.rs | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/crates/nu-command/src/misc/panic.rs b/crates/nu-command/src/misc/panic.rs index f8bb0bae66..cb880c1280 100644 --- a/crates/nu-command/src/misc/panic.rs +++ b/crates/nu-command/src/misc/panic.rs @@ -9,16 +9,22 @@ impl Command for Panic { } fn description(&self) -> &str { - "Executes a rust panic, useful only for testing." + "Causes nushell to panic." + } + + fn search_terms(&self) -> Vec<&str> { + vec!["crash", "throw"] } fn signature(&self) -> nu_protocol::Signature { Signature::build("panic") - .input_output_types(vec![(Type::Nothing, Type::table())]) - // LsGlobPattern is similar to string, it won't auto-expand - // and we use it to track if the user input is quoted. - .optional("msg", SyntaxShape::String, "The glob pattern to use.") - .category(Category::Experimental) + .input_output_types(vec![(Type::Nothing, Type::Nothing)]) + .optional( + "msg", + SyntaxShape::String, + "The custom message for the panic.", + ) + .category(Category::Debug) } fn run( @@ -35,6 +41,10 @@ impl Command for Panic { } fn examples(&self) -> Vec { - vec![] + vec![Example { + description: "Panic with a custom message", + example: "panic 'This is a custom panic message'", + result: None, + }] } }