From d1680c58f0c358245535826a5c69a651866b24d7 Mon Sep 17 00:00:00 2001 From: sholderbach Date: Sun, 4 Aug 2024 21:59:15 +0200 Subject: [PATCH] Group subcommand stuff together --- crates/nu-engine/src/documentation.rs | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/crates/nu-engine/src/documentation.rs b/crates/nu-engine/src/documentation.rs index 6d3f1b8465..d84602f9f6 100644 --- a/crates/nu-engine/src/documentation.rs +++ b/crates/nu-engine/src/documentation.rs @@ -105,6 +105,20 @@ fn get_documentation( long_desc.push_str("\n\n"); } + if !sig.search_terms.is_empty() { + let _ = write!( + long_desc, + "{help_section_name}Search terms{RESET}: {help_subcolor_one}{}{RESET}\n\n", + sig.search_terms.join(", "), + ); + } + + let _ = write!( + long_desc, + "{help_section_name}Usage{RESET}:\n > {}\n", + sig.call_signature() + ); + // TODO: improve the subcommand name resolution // issues: // - Aliases are included @@ -126,20 +140,6 @@ fn get_documentation( } } - if !sig.search_terms.is_empty() { - let _ = write!( - long_desc, - "{help_section_name}Search terms{RESET}: {help_subcolor_one}{}{RESET}\n\n", - sig.search_terms.join(", "), - ); - } - - let _ = write!( - long_desc, - "{help_section_name}Usage{RESET}:\n > {}\n", - sig.call_signature() - ); - if !subcommands.is_empty() { let _ = write!(long_desc, "\n{help_section_name}Subcommands{RESET}:\n"); subcommands.sort();