diff --git a/crates/nu-cli/src/commands/commandline/commandline_.rs b/crates/nu-cli/src/commands/commandline/commandline_.rs index 569de37d65..909c2cc761 100644 --- a/crates/nu-cli/src/commands/commandline/commandline_.rs +++ b/crates/nu-cli/src/commands/commandline/commandline_.rs @@ -14,7 +14,7 @@ impl Command for Commandline { .category(Category::Core) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "View the current command line input buffer." } diff --git a/crates/nu-cli/src/commands/commandline/edit.rs b/crates/nu-cli/src/commands/commandline/edit.rs index f5048d7172..64f3ae2a08 100644 --- a/crates/nu-cli/src/commands/commandline/edit.rs +++ b/crates/nu-cli/src/commands/commandline/edit.rs @@ -34,7 +34,7 @@ impl Command for SubCommand { .category(Category::Core) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Modify the current command line input buffer." } diff --git a/crates/nu-cli/src/commands/commandline/get_cursor.rs b/crates/nu-cli/src/commands/commandline/get_cursor.rs index a50f7e564e..7c49309702 100644 --- a/crates/nu-cli/src/commands/commandline/get_cursor.rs +++ b/crates/nu-cli/src/commands/commandline/get_cursor.rs @@ -16,7 +16,7 @@ impl Command for SubCommand { .category(Category::Core) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Get the current cursor position." } diff --git a/crates/nu-cli/src/commands/commandline/set_cursor.rs b/crates/nu-cli/src/commands/commandline/set_cursor.rs index ddb18dcde3..411d42de57 100644 --- a/crates/nu-cli/src/commands/commandline/set_cursor.rs +++ b/crates/nu-cli/src/commands/commandline/set_cursor.rs @@ -22,7 +22,7 @@ impl Command for SubCommand { .category(Category::Core) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Set the current cursor position." } diff --git a/crates/nu-cli/src/commands/history/history_.rs b/crates/nu-cli/src/commands/history/history_.rs index c270cef003..cf6e0f390f 100644 --- a/crates/nu-cli/src/commands/history/history_.rs +++ b/crates/nu-cli/src/commands/history/history_.rs @@ -13,7 +13,7 @@ impl Command for History { "history" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Get the command history." } diff --git a/crates/nu-cli/src/commands/history/history_session.rs b/crates/nu-cli/src/commands/history/history_session.rs index 5e68e47865..d6e0d0d96f 100644 --- a/crates/nu-cli/src/commands/history/history_session.rs +++ b/crates/nu-cli/src/commands/history/history_session.rs @@ -8,7 +8,7 @@ impl Command for HistorySession { "history session" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Get the command history session." } diff --git a/crates/nu-cli/src/commands/keybindings.rs b/crates/nu-cli/src/commands/keybindings.rs index 347ce983ea..34ae0fa9f3 100644 --- a/crates/nu-cli/src/commands/keybindings.rs +++ b/crates/nu-cli/src/commands/keybindings.rs @@ -14,11 +14,11 @@ impl Command for Keybindings { .input_output_types(vec![(Type::Nothing, Type::String)]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Keybindings related commands." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"You must use one of the following subcommands. Using this command as-is will only produce this help message. For more information on input and keybindings, check: diff --git a/crates/nu-cli/src/commands/keybindings_default.rs b/crates/nu-cli/src/commands/keybindings_default.rs index 1a62942b15..c5ca29dfed 100644 --- a/crates/nu-cli/src/commands/keybindings_default.rs +++ b/crates/nu-cli/src/commands/keybindings_default.rs @@ -15,7 +15,7 @@ impl Command for KeybindingsDefault { .input_output_types(vec![(Type::Nothing, Type::table())]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "List default keybindings." } diff --git a/crates/nu-cli/src/commands/keybindings_list.rs b/crates/nu-cli/src/commands/keybindings_list.rs index abb5909a97..6332ec31f0 100644 --- a/crates/nu-cli/src/commands/keybindings_list.rs +++ b/crates/nu-cli/src/commands/keybindings_list.rs @@ -23,7 +23,7 @@ impl Command for KeybindingsList { .category(Category::Platform) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "List available options that can be used to create keybindings." } diff --git a/crates/nu-cli/src/commands/keybindings_listen.rs b/crates/nu-cli/src/commands/keybindings_listen.rs index 1cb443e360..40cda5652d 100644 --- a/crates/nu-cli/src/commands/keybindings_listen.rs +++ b/crates/nu-cli/src/commands/keybindings_listen.rs @@ -12,11 +12,11 @@ impl Command for KeybindingsListen { "keybindings listen" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Get input from the user." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "This is an internal debugging tool. For better output, try `input listen --types [key]`" } diff --git a/crates/nu-cli/src/menus/help_completions.rs b/crates/nu-cli/src/menus/help_completions.rs index 7dc157748e..ed60579f81 100644 --- a/crates/nu-cli/src/menus/help_completions.rs +++ b/crates/nu-cli/src/menus/help_completions.rs @@ -30,12 +30,15 @@ impl NuHelpCompleter { .filter_map(|(_, decl_id)| { let decl = self.engine_state.get_decl(decl_id); (decl.name().to_folded_case().contains(&folded_line) - || decl.usage().to_folded_case().contains(&folded_line) + || decl.description().to_folded_case().contains(&folded_line) || decl .search_terms() .into_iter() .any(|term| term.to_folded_case().contains(&folded_line)) - || decl.extra_usage().to_folded_case().contains(&folded_line)) + || decl + .extra_description() + .to_folded_case() + .contains(&folded_line)) .then_some(decl) }) .collect::>(); @@ -47,15 +50,15 @@ impl NuHelpCompleter { .map(|decl| { let mut long_desc = String::new(); - let usage = decl.usage(); - if !usage.is_empty() { - long_desc.push_str(usage); + let description = decl.description(); + if !description.is_empty() { + long_desc.push_str(description); long_desc.push_str("\r\n\r\n"); } - let extra_usage = decl.extra_usage(); - if !extra_usage.is_empty() { - long_desc.push_str(extra_usage); + let extra_desc = decl.extra_description(); + if !extra_desc.is_empty() { + long_desc.push_str(extra_desc); long_desc.push_str("\r\n\r\n"); } diff --git a/crates/nu-cli/src/nu_highlight.rs b/crates/nu-cli/src/nu_highlight.rs index 0b5f211838..dd202cc061 100644 --- a/crates/nu-cli/src/nu_highlight.rs +++ b/crates/nu-cli/src/nu_highlight.rs @@ -17,7 +17,7 @@ impl Command for NuHighlight { .input_output_types(vec![(Type::String, Type::String)]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Syntax highlight the input string." } diff --git a/crates/nu-cli/src/print.rs b/crates/nu-cli/src/print.rs index e84c9d5e8f..66e736ca4f 100644 --- a/crates/nu-cli/src/print.rs +++ b/crates/nu-cli/src/print.rs @@ -30,11 +30,11 @@ impl Command for Print { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Print the given values to stdout." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"Unlike `echo`, this command does not return any value (`print | describe` will return "nothing"). Since this command has no output, there is no point in piping it with other commands. diff --git a/crates/nu-cmd-extra/src/extra/bits/and.rs b/crates/nu-cmd-extra/src/extra/bits/and.rs index 234b4e5cc1..a87508732d 100644 --- a/crates/nu-cmd-extra/src/extra/bits/and.rs +++ b/crates/nu-cmd-extra/src/extra/bits/and.rs @@ -37,7 +37,7 @@ impl Command for BitsAnd { .category(Category::Bits) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Performs bitwise and for ints or binary values." } diff --git a/crates/nu-cmd-extra/src/extra/bits/bits_.rs b/crates/nu-cmd-extra/src/extra/bits/bits_.rs index 1190c01b4d..cb07a6420a 100644 --- a/crates/nu-cmd-extra/src/extra/bits/bits_.rs +++ b/crates/nu-cmd-extra/src/extra/bits/bits_.rs @@ -14,11 +14,11 @@ impl Command for Bits { .input_output_types(vec![(Type::Nothing, Type::String)]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Various commands for working with bits." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu-cmd-extra/src/extra/bits/into.rs b/crates/nu-cmd-extra/src/extra/bits/into.rs index 9ff8bd0a05..7edc8d3584 100644 --- a/crates/nu-cmd-extra/src/extra/bits/into.rs +++ b/crates/nu-cmd-extra/src/extra/bits/into.rs @@ -45,7 +45,7 @@ impl Command for BitsInto { .category(Category::Conversions) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert value to a binary primitive." } diff --git a/crates/nu-cmd-extra/src/extra/bits/not.rs b/crates/nu-cmd-extra/src/extra/bits/not.rs index 405cc79d7e..d014d21abe 100644 --- a/crates/nu-cmd-extra/src/extra/bits/not.rs +++ b/crates/nu-cmd-extra/src/extra/bits/not.rs @@ -51,7 +51,7 @@ impl Command for BitsNot { .category(Category::Bits) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Performs logical negation on each bit." } diff --git a/crates/nu-cmd-extra/src/extra/bits/or.rs b/crates/nu-cmd-extra/src/extra/bits/or.rs index a0af2dc8d0..287b841750 100644 --- a/crates/nu-cmd-extra/src/extra/bits/or.rs +++ b/crates/nu-cmd-extra/src/extra/bits/or.rs @@ -38,7 +38,7 @@ impl Command for BitsOr { .category(Category::Bits) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Performs bitwise or for ints or binary values." } diff --git a/crates/nu-cmd-extra/src/extra/bits/rotate_left.rs b/crates/nu-cmd-extra/src/extra/bits/rotate_left.rs index 5bb9e42f6b..e1560fb157 100644 --- a/crates/nu-cmd-extra/src/extra/bits/rotate_left.rs +++ b/crates/nu-cmd-extra/src/extra/bits/rotate_left.rs @@ -53,7 +53,7 @@ impl Command for BitsRol { .category(Category::Bits) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Bitwise rotate left for ints or binary values." } diff --git a/crates/nu-cmd-extra/src/extra/bits/rotate_right.rs b/crates/nu-cmd-extra/src/extra/bits/rotate_right.rs index 31e17891a3..ed5fc49bd8 100644 --- a/crates/nu-cmd-extra/src/extra/bits/rotate_right.rs +++ b/crates/nu-cmd-extra/src/extra/bits/rotate_right.rs @@ -53,7 +53,7 @@ impl Command for BitsRor { .category(Category::Bits) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Bitwise rotate right for ints or binary values." } diff --git a/crates/nu-cmd-extra/src/extra/bits/shift_left.rs b/crates/nu-cmd-extra/src/extra/bits/shift_left.rs index e3b484a7d4..155e20a429 100644 --- a/crates/nu-cmd-extra/src/extra/bits/shift_left.rs +++ b/crates/nu-cmd-extra/src/extra/bits/shift_left.rs @@ -55,7 +55,7 @@ impl Command for BitsShl { .category(Category::Bits) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Bitwise shift left for ints or binary values." } diff --git a/crates/nu-cmd-extra/src/extra/bits/shift_right.rs b/crates/nu-cmd-extra/src/extra/bits/shift_right.rs index 9bb5b1563a..bc4f165d61 100644 --- a/crates/nu-cmd-extra/src/extra/bits/shift_right.rs +++ b/crates/nu-cmd-extra/src/extra/bits/shift_right.rs @@ -52,7 +52,7 @@ impl Command for BitsShr { .category(Category::Bits) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Bitwise shift right for ints or binary values." } diff --git a/crates/nu-cmd-extra/src/extra/bits/xor.rs b/crates/nu-cmd-extra/src/extra/bits/xor.rs index 4a71487137..2474bf27f1 100644 --- a/crates/nu-cmd-extra/src/extra/bits/xor.rs +++ b/crates/nu-cmd-extra/src/extra/bits/xor.rs @@ -38,7 +38,7 @@ impl Command for BitsXor { .category(Category::Bits) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Performs bitwise xor for ints or binary values." } diff --git a/crates/nu-cmd-extra/src/extra/conversions/fmt.rs b/crates/nu-cmd-extra/src/extra/conversions/fmt.rs index 3b682291e7..15ca742c76 100644 --- a/crates/nu-cmd-extra/src/extra/conversions/fmt.rs +++ b/crates/nu-cmd-extra/src/extra/conversions/fmt.rs @@ -9,7 +9,7 @@ impl Command for Fmt { "fmt" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Format a number." } diff --git a/crates/nu-cmd-extra/src/extra/filters/each_while.rs b/crates/nu-cmd-extra/src/extra/filters/each_while.rs index 1f30e5b9b9..67f0cc9482 100644 --- a/crates/nu-cmd-extra/src/extra/filters/each_while.rs +++ b/crates/nu-cmd-extra/src/extra/filters/each_while.rs @@ -9,7 +9,7 @@ impl Command for EachWhile { "each while" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Run a closure on each row of the input list until a null is found, then create a new list with the results." } diff --git a/crates/nu-cmd-extra/src/extra/filters/roll/roll_.rs b/crates/nu-cmd-extra/src/extra/filters/roll/roll_.rs index 867bc2706e..60db022fde 100644 --- a/crates/nu-cmd-extra/src/extra/filters/roll/roll_.rs +++ b/crates/nu-cmd-extra/src/extra/filters/roll/roll_.rs @@ -18,11 +18,11 @@ impl Command for Roll { .input_output_types(vec![(Type::Nothing, Type::String)]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Rolling commands for tables." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu-cmd-extra/src/extra/filters/roll/roll_down.rs b/crates/nu-cmd-extra/src/extra/filters/roll/roll_down.rs index 24ea1bc309..a7a1cc6be5 100644 --- a/crates/nu-cmd-extra/src/extra/filters/roll/roll_down.rs +++ b/crates/nu-cmd-extra/src/extra/filters/roll/roll_down.rs @@ -21,7 +21,7 @@ impl Command for RollDown { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Roll table rows down." } diff --git a/crates/nu-cmd-extra/src/extra/filters/roll/roll_left.rs b/crates/nu-cmd-extra/src/extra/filters/roll/roll_left.rs index 789b70830d..8d6616156b 100644 --- a/crates/nu-cmd-extra/src/extra/filters/roll/roll_left.rs +++ b/crates/nu-cmd-extra/src/extra/filters/roll/roll_left.rs @@ -33,7 +33,7 @@ impl Command for RollLeft { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Roll record or table columns left." } diff --git a/crates/nu-cmd-extra/src/extra/filters/roll/roll_right.rs b/crates/nu-cmd-extra/src/extra/filters/roll/roll_right.rs index 55a1e42158..7657e73dc7 100644 --- a/crates/nu-cmd-extra/src/extra/filters/roll/roll_right.rs +++ b/crates/nu-cmd-extra/src/extra/filters/roll/roll_right.rs @@ -33,7 +33,7 @@ impl Command for RollRight { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Roll table columns right." } diff --git a/crates/nu-cmd-extra/src/extra/filters/roll/roll_up.rs b/crates/nu-cmd-extra/src/extra/filters/roll/roll_up.rs index 7b9480599d..ffdabca8eb 100644 --- a/crates/nu-cmd-extra/src/extra/filters/roll/roll_up.rs +++ b/crates/nu-cmd-extra/src/extra/filters/roll/roll_up.rs @@ -21,7 +21,7 @@ impl Command for RollUp { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Roll table rows up." } diff --git a/crates/nu-cmd-extra/src/extra/filters/rotate.rs b/crates/nu-cmd-extra/src/extra/filters/rotate.rs index 1d93109604..2ebe6478e4 100644 --- a/crates/nu-cmd-extra/src/extra/filters/rotate.rs +++ b/crates/nu-cmd-extra/src/extra/filters/rotate.rs @@ -23,7 +23,7 @@ impl Command for Rotate { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Rotates a table or record clockwise (default) or counter-clockwise (use --ccw flag)." } diff --git a/crates/nu-cmd-extra/src/extra/filters/update_cells.rs b/crates/nu-cmd-extra/src/extra/filters/update_cells.rs index b102c13c0d..7cfc20de23 100644 --- a/crates/nu-cmd-extra/src/extra/filters/update_cells.rs +++ b/crates/nu-cmd-extra/src/extra/filters/update_cells.rs @@ -27,7 +27,7 @@ impl Command for UpdateCells { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Update the table cells." } diff --git a/crates/nu-cmd-extra/src/extra/formats/from/url.rs b/crates/nu-cmd-extra/src/extra/formats/from/url.rs index c8e21aa703..b1e8329020 100644 --- a/crates/nu-cmd-extra/src/extra/formats/from/url.rs +++ b/crates/nu-cmd-extra/src/extra/formats/from/url.rs @@ -14,7 +14,7 @@ impl Command for FromUrl { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Parse url-encoded string as a record." } diff --git a/crates/nu-cmd-extra/src/extra/formats/to/html.rs b/crates/nu-cmd-extra/src/extra/formats/to/html.rs index f02f11cf84..b047b386f1 100644 --- a/crates/nu-cmd-extra/src/extra/formats/to/html.rs +++ b/crates/nu-cmd-extra/src/extra/formats/to/html.rs @@ -138,11 +138,11 @@ impl Command for ToHtml { ] } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert table into simple HTML." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "Screenshots of the themes can be browsed here: https://github.com/mbadolato/iTerm2-Color-Schemes." } diff --git a/crates/nu-cmd-extra/src/extra/math/arccos.rs b/crates/nu-cmd-extra/src/extra/math/arccos.rs index 5d0a659380..229e7e4520 100644 --- a/crates/nu-cmd-extra/src/extra/math/arccos.rs +++ b/crates/nu-cmd-extra/src/extra/math/arccos.rs @@ -22,7 +22,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the arccosine of the number." } diff --git a/crates/nu-cmd-extra/src/extra/math/arccosh.rs b/crates/nu-cmd-extra/src/extra/math/arccosh.rs index 532a388b3f..c15c72dc36 100644 --- a/crates/nu-cmd-extra/src/extra/math/arccosh.rs +++ b/crates/nu-cmd-extra/src/extra/math/arccosh.rs @@ -21,7 +21,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the inverse of the hyperbolic cosine function." } diff --git a/crates/nu-cmd-extra/src/extra/math/arcsin.rs b/crates/nu-cmd-extra/src/extra/math/arcsin.rs index a85c438367..b1f4438e2b 100644 --- a/crates/nu-cmd-extra/src/extra/math/arcsin.rs +++ b/crates/nu-cmd-extra/src/extra/math/arcsin.rs @@ -22,7 +22,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the arcsine of the number." } diff --git a/crates/nu-cmd-extra/src/extra/math/arcsinh.rs b/crates/nu-cmd-extra/src/extra/math/arcsinh.rs index 91cb814a32..a2fce1f057 100644 --- a/crates/nu-cmd-extra/src/extra/math/arcsinh.rs +++ b/crates/nu-cmd-extra/src/extra/math/arcsinh.rs @@ -21,7 +21,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the inverse of the hyperbolic sine function." } diff --git a/crates/nu-cmd-extra/src/extra/math/arctan.rs b/crates/nu-cmd-extra/src/extra/math/arctan.rs index f52c8bd40c..f3bcc74150 100644 --- a/crates/nu-cmd-extra/src/extra/math/arctan.rs +++ b/crates/nu-cmd-extra/src/extra/math/arctan.rs @@ -22,7 +22,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the arctangent of the number." } diff --git a/crates/nu-cmd-extra/src/extra/math/arctanh.rs b/crates/nu-cmd-extra/src/extra/math/arctanh.rs index 7791b56948..bd01e7f101 100644 --- a/crates/nu-cmd-extra/src/extra/math/arctanh.rs +++ b/crates/nu-cmd-extra/src/extra/math/arctanh.rs @@ -21,7 +21,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the inverse of the hyperbolic tangent function." } diff --git a/crates/nu-cmd-extra/src/extra/math/cos.rs b/crates/nu-cmd-extra/src/extra/math/cos.rs index 252c7dbbd6..5ec0777edf 100644 --- a/crates/nu-cmd-extra/src/extra/math/cos.rs +++ b/crates/nu-cmd-extra/src/extra/math/cos.rs @@ -21,7 +21,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the cosine of the number." } diff --git a/crates/nu-cmd-extra/src/extra/math/cosh.rs b/crates/nu-cmd-extra/src/extra/math/cosh.rs index e46d3c4df8..68bdc6094a 100644 --- a/crates/nu-cmd-extra/src/extra/math/cosh.rs +++ b/crates/nu-cmd-extra/src/extra/math/cosh.rs @@ -21,7 +21,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the hyperbolic cosine of the number." } diff --git a/crates/nu-cmd-extra/src/extra/math/exp.rs b/crates/nu-cmd-extra/src/extra/math/exp.rs index d8f6a52899..0b28274dae 100644 --- a/crates/nu-cmd-extra/src/extra/math/exp.rs +++ b/crates/nu-cmd-extra/src/extra/math/exp.rs @@ -21,7 +21,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns e raised to the power of x." } diff --git a/crates/nu-cmd-extra/src/extra/math/ln.rs b/crates/nu-cmd-extra/src/extra/math/ln.rs index 694192bc8e..147f536028 100644 --- a/crates/nu-cmd-extra/src/extra/math/ln.rs +++ b/crates/nu-cmd-extra/src/extra/math/ln.rs @@ -21,7 +21,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the natural logarithm. Base: (math e)." } diff --git a/crates/nu-cmd-extra/src/extra/math/sin.rs b/crates/nu-cmd-extra/src/extra/math/sin.rs index 0caedbabe7..fcaa693b8d 100644 --- a/crates/nu-cmd-extra/src/extra/math/sin.rs +++ b/crates/nu-cmd-extra/src/extra/math/sin.rs @@ -21,7 +21,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the sine of the number." } diff --git a/crates/nu-cmd-extra/src/extra/math/sinh.rs b/crates/nu-cmd-extra/src/extra/math/sinh.rs index d40db3bcb5..2e852e42f1 100644 --- a/crates/nu-cmd-extra/src/extra/math/sinh.rs +++ b/crates/nu-cmd-extra/src/extra/math/sinh.rs @@ -21,7 +21,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the hyperbolic sine of the number." } diff --git a/crates/nu-cmd-extra/src/extra/math/tan.rs b/crates/nu-cmd-extra/src/extra/math/tan.rs index 97c5d2ff93..025b9817c5 100644 --- a/crates/nu-cmd-extra/src/extra/math/tan.rs +++ b/crates/nu-cmd-extra/src/extra/math/tan.rs @@ -21,7 +21,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the tangent of the number." } diff --git a/crates/nu-cmd-extra/src/extra/math/tanh.rs b/crates/nu-cmd-extra/src/extra/math/tanh.rs index 6679d04fe5..9ac10444d9 100644 --- a/crates/nu-cmd-extra/src/extra/math/tanh.rs +++ b/crates/nu-cmd-extra/src/extra/math/tanh.rs @@ -21,7 +21,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the hyperbolic tangent of the number." } diff --git a/crates/nu-cmd-extra/src/extra/platform/ansi/gradient.rs b/crates/nu-cmd-extra/src/extra/platform/ansi/gradient.rs index 5934b57a5d..433757e6c7 100644 --- a/crates/nu-cmd-extra/src/extra/platform/ansi/gradient.rs +++ b/crates/nu-cmd-extra/src/extra/platform/ansi/gradient.rs @@ -53,7 +53,7 @@ impl Command for SubCommand { .category(Category::Platform) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Add a color gradient (using ANSI color codes) to the given string." } diff --git a/crates/nu-cmd-extra/src/extra/strings/encode_decode/decode_hex.rs b/crates/nu-cmd-extra/src/extra/strings/encode_decode/decode_hex.rs index 7be007d1c7..f846afed71 100644 --- a/crates/nu-cmd-extra/src/extra/strings/encode_decode/decode_hex.rs +++ b/crates/nu-cmd-extra/src/extra/strings/encode_decode/decode_hex.rs @@ -29,7 +29,7 @@ impl Command for DecodeHex { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Hex decode a value." } diff --git a/crates/nu-cmd-extra/src/extra/strings/encode_decode/encode_hex.rs b/crates/nu-cmd-extra/src/extra/strings/encode_decode/encode_hex.rs index d261f7fe1f..c3a5467ca8 100644 --- a/crates/nu-cmd-extra/src/extra/strings/encode_decode/encode_hex.rs +++ b/crates/nu-cmd-extra/src/extra/strings/encode_decode/encode_hex.rs @@ -29,7 +29,7 @@ impl Command for EncodeHex { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Encode a binary value using hex." } diff --git a/crates/nu-cmd-extra/src/extra/strings/format/command.rs b/crates/nu-cmd-extra/src/extra/strings/format/command.rs index ef9b6f2baf..522fc6b05d 100644 --- a/crates/nu-cmd-extra/src/extra/strings/format/command.rs +++ b/crates/nu-cmd-extra/src/extra/strings/format/command.rs @@ -24,7 +24,7 @@ impl Command for FormatPattern { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Format columns into a string using a simple pattern." } diff --git a/crates/nu-cmd-extra/src/extra/strings/str_/case/camel_case.rs b/crates/nu-cmd-extra/src/extra/strings/str_/case/camel_case.rs index e48bc10e1e..781848d7d8 100644 --- a/crates/nu-cmd-extra/src/extra/strings/str_/case/camel_case.rs +++ b/crates/nu-cmd-extra/src/extra/strings/str_/case/camel_case.rs @@ -30,7 +30,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert a string to camelCase." } diff --git a/crates/nu-cmd-extra/src/extra/strings/str_/case/kebab_case.rs b/crates/nu-cmd-extra/src/extra/strings/str_/case/kebab_case.rs index 7e1accffaf..74c2d031e5 100644 --- a/crates/nu-cmd-extra/src/extra/strings/str_/case/kebab_case.rs +++ b/crates/nu-cmd-extra/src/extra/strings/str_/case/kebab_case.rs @@ -30,7 +30,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert a string to kebab-case." } diff --git a/crates/nu-cmd-extra/src/extra/strings/str_/case/pascal_case.rs b/crates/nu-cmd-extra/src/extra/strings/str_/case/pascal_case.rs index a38c3715c9..1372537ed5 100644 --- a/crates/nu-cmd-extra/src/extra/strings/str_/case/pascal_case.rs +++ b/crates/nu-cmd-extra/src/extra/strings/str_/case/pascal_case.rs @@ -30,7 +30,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert a string to PascalCase." } diff --git a/crates/nu-cmd-extra/src/extra/strings/str_/case/screaming_snake_case.rs b/crates/nu-cmd-extra/src/extra/strings/str_/case/screaming_snake_case.rs index d67b72f1b7..c8b918b37f 100644 --- a/crates/nu-cmd-extra/src/extra/strings/str_/case/screaming_snake_case.rs +++ b/crates/nu-cmd-extra/src/extra/strings/str_/case/screaming_snake_case.rs @@ -30,7 +30,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert a string to SCREAMING_SNAKE_CASE." } diff --git a/crates/nu-cmd-extra/src/extra/strings/str_/case/snake_case.rs b/crates/nu-cmd-extra/src/extra/strings/str_/case/snake_case.rs index 84338295c3..56a9b8b754 100644 --- a/crates/nu-cmd-extra/src/extra/strings/str_/case/snake_case.rs +++ b/crates/nu-cmd-extra/src/extra/strings/str_/case/snake_case.rs @@ -30,7 +30,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert a string to snake_case." } diff --git a/crates/nu-cmd-extra/src/extra/strings/str_/case/str_.rs b/crates/nu-cmd-extra/src/extra/strings/str_/case/str_.rs index fe6cb86324..4ee04ec1e4 100644 --- a/crates/nu-cmd-extra/src/extra/strings/str_/case/str_.rs +++ b/crates/nu-cmd-extra/src/extra/strings/str_/case/str_.rs @@ -14,11 +14,11 @@ impl Command for Str { .input_output_types(vec![(Type::Nothing, Type::String)]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Various commands for working with string data." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu-cmd-extra/src/extra/strings/str_/case/title_case.rs b/crates/nu-cmd-extra/src/extra/strings/str_/case/title_case.rs index ffcfd8d8d4..02d7efcb2e 100644 --- a/crates/nu-cmd-extra/src/extra/strings/str_/case/title_case.rs +++ b/crates/nu-cmd-extra/src/extra/strings/str_/case/title_case.rs @@ -30,7 +30,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert a string to Title Case." } diff --git a/crates/nu-cmd-lang/src/core_commands/alias.rs b/crates/nu-cmd-lang/src/core_commands/alias.rs index f14f4d5827..07f41bb73c 100644 --- a/crates/nu-cmd-lang/src/core_commands/alias.rs +++ b/crates/nu-cmd-lang/src/core_commands/alias.rs @@ -9,7 +9,7 @@ impl Command for Alias { "alias" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Alias a command (with optional flags) to a new name." } @@ -25,7 +25,7 @@ impl Command for Alias { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/break_.rs b/crates/nu-cmd-lang/src/core_commands/break_.rs index 943e32a531..69c8089370 100644 --- a/crates/nu-cmd-lang/src/core_commands/break_.rs +++ b/crates/nu-cmd-lang/src/core_commands/break_.rs @@ -9,7 +9,7 @@ impl Command for Break { "break" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Break a loop." } @@ -19,7 +19,7 @@ impl Command for Break { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html diff --git a/crates/nu-cmd-lang/src/core_commands/collect.rs b/crates/nu-cmd-lang/src/core_commands/collect.rs index d6282eec35..709904de84 100644 --- a/crates/nu-cmd-lang/src/core_commands/collect.rs +++ b/crates/nu-cmd-lang/src/core_commands/collect.rs @@ -25,11 +25,11 @@ impl Command for Collect { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Collect a stream into a value." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"If provided, run a closure with the collected value as input. The entire stream will be collected into one value in memory, so if the stream diff --git a/crates/nu-cmd-lang/src/core_commands/const_.rs b/crates/nu-cmd-lang/src/core_commands/const_.rs index 5b3d03443a..67182faedd 100644 --- a/crates/nu-cmd-lang/src/core_commands/const_.rs +++ b/crates/nu-cmd-lang/src/core_commands/const_.rs @@ -9,7 +9,7 @@ impl Command for Const { "const" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Create a parse-time constant." } @@ -26,7 +26,7 @@ impl Command for Const { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/continue_.rs b/crates/nu-cmd-lang/src/core_commands/continue_.rs index b795456c1d..1c070286d2 100644 --- a/crates/nu-cmd-lang/src/core_commands/continue_.rs +++ b/crates/nu-cmd-lang/src/core_commands/continue_.rs @@ -9,7 +9,7 @@ impl Command for Continue { "continue" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Continue a loop from the next iteration." } @@ -19,7 +19,7 @@ impl Command for Continue { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html diff --git a/crates/nu-cmd-lang/src/core_commands/def.rs b/crates/nu-cmd-lang/src/core_commands/def.rs index 7f8613f315..efb5bdfae2 100644 --- a/crates/nu-cmd-lang/src/core_commands/def.rs +++ b/crates/nu-cmd-lang/src/core_commands/def.rs @@ -9,7 +9,7 @@ impl Command for Def { "def" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Define a custom command." } @@ -24,7 +24,7 @@ impl Command for Def { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/describe.rs b/crates/nu-cmd-lang/src/core_commands/describe.rs index 3d992f3f33..5df62e6793 100644 --- a/crates/nu-cmd-lang/src/core_commands/describe.rs +++ b/crates/nu-cmd-lang/src/core_commands/describe.rs @@ -9,7 +9,7 @@ impl Command for Describe { "describe" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Describe the type and structure of the value(s) piped in." } diff --git a/crates/nu-cmd-lang/src/core_commands/do_.rs b/crates/nu-cmd-lang/src/core_commands/do_.rs index bf29a2159a..61c9cf09a0 100644 --- a/crates/nu-cmd-lang/src/core_commands/do_.rs +++ b/crates/nu-cmd-lang/src/core_commands/do_.rs @@ -17,7 +17,7 @@ impl Command for Do { "do" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Run a closure, providing it with the pipeline input." } diff --git a/crates/nu-cmd-lang/src/core_commands/echo.rs b/crates/nu-cmd-lang/src/core_commands/echo.rs index 00c8b1329c..d4ebeb2aa8 100644 --- a/crates/nu-cmd-lang/src/core_commands/echo.rs +++ b/crates/nu-cmd-lang/src/core_commands/echo.rs @@ -8,7 +8,7 @@ impl Command for Echo { "echo" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns its arguments, ignoring the piped-in value." } @@ -19,7 +19,7 @@ impl Command for Echo { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"Unlike `print`, which prints unstructured text to stdout, `echo` is like an identity function and simply returns its arguments. When given no arguments, it returns an empty string. When given one argument, it returns it as a diff --git a/crates/nu-cmd-lang/src/core_commands/error_make.rs b/crates/nu-cmd-lang/src/core_commands/error_make.rs index 07efcd7885..97bead75ff 100644 --- a/crates/nu-cmd-lang/src/core_commands/error_make.rs +++ b/crates/nu-cmd-lang/src/core_commands/error_make.rs @@ -25,7 +25,7 @@ impl Command for ErrorMake { .category(Category::Core) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Create an error." } diff --git a/crates/nu-cmd-lang/src/core_commands/export.rs b/crates/nu-cmd-lang/src/core_commands/export.rs index 565e7895dc..d7e923da7f 100644 --- a/crates/nu-cmd-lang/src/core_commands/export.rs +++ b/crates/nu-cmd-lang/src/core_commands/export.rs @@ -15,11 +15,11 @@ impl Command for ExportCommand { .category(Category::Core) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Export definitions or environment variables from a module." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/export_alias.rs b/crates/nu-cmd-lang/src/core_commands/export_alias.rs index 4df335da44..a3001cd83a 100644 --- a/crates/nu-cmd-lang/src/core_commands/export_alias.rs +++ b/crates/nu-cmd-lang/src/core_commands/export_alias.rs @@ -9,7 +9,7 @@ impl Command for ExportAlias { "export alias" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Alias a command (with optional flags) to a new name and export it from a module." } @@ -25,7 +25,7 @@ impl Command for ExportAlias { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/export_const.rs b/crates/nu-cmd-lang/src/core_commands/export_const.rs index 631d85ad89..59e93850c4 100644 --- a/crates/nu-cmd-lang/src/core_commands/export_const.rs +++ b/crates/nu-cmd-lang/src/core_commands/export_const.rs @@ -9,7 +9,7 @@ impl Command for ExportConst { "export const" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Use parse-time constant from a module and export them from this module." } @@ -26,7 +26,7 @@ impl Command for ExportConst { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/export_def.rs b/crates/nu-cmd-lang/src/core_commands/export_def.rs index 7a2d3949e1..51c4c871a2 100644 --- a/crates/nu-cmd-lang/src/core_commands/export_def.rs +++ b/crates/nu-cmd-lang/src/core_commands/export_def.rs @@ -9,7 +9,7 @@ impl Command for ExportDef { "export def" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Define a custom command and export it from a module." } @@ -24,7 +24,7 @@ impl Command for ExportDef { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/export_extern.rs b/crates/nu-cmd-lang/src/core_commands/export_extern.rs index 1a2ba4e5cb..580e503e20 100644 --- a/crates/nu-cmd-lang/src/core_commands/export_extern.rs +++ b/crates/nu-cmd-lang/src/core_commands/export_extern.rs @@ -9,7 +9,7 @@ impl Command for ExportExtern { "export extern" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Define an extern and export it from a module." } @@ -21,7 +21,7 @@ impl Command for ExportExtern { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/export_module.rs b/crates/nu-cmd-lang/src/core_commands/export_module.rs index 53a6ca750c..c749c1a43f 100644 --- a/crates/nu-cmd-lang/src/core_commands/export_module.rs +++ b/crates/nu-cmd-lang/src/core_commands/export_module.rs @@ -9,7 +9,7 @@ impl Command for ExportModule { "export module" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Export a custom module from a module." } @@ -26,7 +26,7 @@ impl Command for ExportModule { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/export_use.rs b/crates/nu-cmd-lang/src/core_commands/export_use.rs index 5ca96a899e..4d2c3bf5e4 100644 --- a/crates/nu-cmd-lang/src/core_commands/export_use.rs +++ b/crates/nu-cmd-lang/src/core_commands/export_use.rs @@ -9,7 +9,7 @@ impl Command for ExportUse { "export use" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Use definitions from a module and export them from this module." } @@ -25,7 +25,7 @@ impl Command for ExportUse { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/extern_.rs b/crates/nu-cmd-lang/src/core_commands/extern_.rs index 496f104650..c0afcdf74b 100644 --- a/crates/nu-cmd-lang/src/core_commands/extern_.rs +++ b/crates/nu-cmd-lang/src/core_commands/extern_.rs @@ -9,7 +9,7 @@ impl Command for Extern { "extern" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Define a signature for an external command." } @@ -21,7 +21,7 @@ impl Command for Extern { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/for_.rs b/crates/nu-cmd-lang/src/core_commands/for_.rs index 36df743e5f..16e1364225 100644 --- a/crates/nu-cmd-lang/src/core_commands/for_.rs +++ b/crates/nu-cmd-lang/src/core_commands/for_.rs @@ -9,7 +9,7 @@ impl Command for For { "for" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Loop over a range." } @@ -32,7 +32,7 @@ impl Command for For { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/hide.rs b/crates/nu-cmd-lang/src/core_commands/hide.rs index d52d2131c9..b51a21e979 100644 --- a/crates/nu-cmd-lang/src/core_commands/hide.rs +++ b/crates/nu-cmd-lang/src/core_commands/hide.rs @@ -21,11 +21,11 @@ impl Command for Hide { .category(Category::Core) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Hide definitions in the current scope." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"Definitions are hidden by priority: First aliases, then custom commands. This command is a parser keyword. For details, check: diff --git a/crates/nu-cmd-lang/src/core_commands/hide_env.rs b/crates/nu-cmd-lang/src/core_commands/hide_env.rs index 43ed830629..adc430b168 100644 --- a/crates/nu-cmd-lang/src/core_commands/hide_env.rs +++ b/crates/nu-cmd-lang/src/core_commands/hide_env.rs @@ -25,7 +25,7 @@ impl Command for HideEnv { .category(Category::Core) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Hide environment variables in the current scope." } diff --git a/crates/nu-cmd-lang/src/core_commands/if_.rs b/crates/nu-cmd-lang/src/core_commands/if_.rs index 8667843770..3b18b23879 100644 --- a/crates/nu-cmd-lang/src/core_commands/if_.rs +++ b/crates/nu-cmd-lang/src/core_commands/if_.rs @@ -14,7 +14,7 @@ impl Command for If { "if" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Conditionally run a block." } @@ -41,7 +41,7 @@ impl Command for If { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/ignore.rs b/crates/nu-cmd-lang/src/core_commands/ignore.rs index bca7f84a1a..2b3d31ba9f 100644 --- a/crates/nu-cmd-lang/src/core_commands/ignore.rs +++ b/crates/nu-cmd-lang/src/core_commands/ignore.rs @@ -9,7 +9,7 @@ impl Command for Ignore { "ignore" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Ignore the output of the previous command in the pipeline." } diff --git a/crates/nu-cmd-lang/src/core_commands/let_.rs b/crates/nu-cmd-lang/src/core_commands/let_.rs index 46324ef39e..3e0b2f97eb 100644 --- a/crates/nu-cmd-lang/src/core_commands/let_.rs +++ b/crates/nu-cmd-lang/src/core_commands/let_.rs @@ -9,7 +9,7 @@ impl Command for Let { "let" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Create a variable and give it a value." } @@ -26,7 +26,7 @@ impl Command for Let { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/loop_.rs b/crates/nu-cmd-lang/src/core_commands/loop_.rs index f495c8d3ae..1ef3706a6e 100644 --- a/crates/nu-cmd-lang/src/core_commands/loop_.rs +++ b/crates/nu-cmd-lang/src/core_commands/loop_.rs @@ -9,7 +9,7 @@ impl Command for Loop { "loop" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Run a block in a loop." } @@ -21,7 +21,7 @@ impl Command for Loop { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/match_.rs b/crates/nu-cmd-lang/src/core_commands/match_.rs index c3a3d61216..71ec8ebaec 100644 --- a/crates/nu-cmd-lang/src/core_commands/match_.rs +++ b/crates/nu-cmd-lang/src/core_commands/match_.rs @@ -11,7 +11,7 @@ impl Command for Match { "match" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Conditionally run a block on a matched value." } @@ -27,7 +27,7 @@ impl Command for Match { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/module.rs b/crates/nu-cmd-lang/src/core_commands/module.rs index 908c0764e5..4ed2d5c599 100644 --- a/crates/nu-cmd-lang/src/core_commands/module.rs +++ b/crates/nu-cmd-lang/src/core_commands/module.rs @@ -9,7 +9,7 @@ impl Command for Module { "module" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Define a custom module." } @@ -26,7 +26,7 @@ impl Command for Module { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/mut_.rs b/crates/nu-cmd-lang/src/core_commands/mut_.rs index b729590027..a72d8f484f 100644 --- a/crates/nu-cmd-lang/src/core_commands/mut_.rs +++ b/crates/nu-cmd-lang/src/core_commands/mut_.rs @@ -9,7 +9,7 @@ impl Command for Mut { "mut" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Create a mutable variable and give it a value." } @@ -26,7 +26,7 @@ impl Command for Mut { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/overlay/command.rs b/crates/nu-cmd-lang/src/core_commands/overlay/command.rs index 00ec7438ad..c39df288d6 100644 --- a/crates/nu-cmd-lang/src/core_commands/overlay/command.rs +++ b/crates/nu-cmd-lang/src/core_commands/overlay/command.rs @@ -15,11 +15,11 @@ impl Command for Overlay { .input_output_types(vec![(Type::Nothing, Type::String)]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Commands for manipulating overlays." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html diff --git a/crates/nu-cmd-lang/src/core_commands/overlay/hide.rs b/crates/nu-cmd-lang/src/core_commands/overlay/hide.rs index 7ea84a2a91..0228eb10db 100644 --- a/crates/nu-cmd-lang/src/core_commands/overlay/hide.rs +++ b/crates/nu-cmd-lang/src/core_commands/overlay/hide.rs @@ -9,7 +9,7 @@ impl Command for OverlayHide { "overlay hide" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Hide an active overlay." } @@ -31,7 +31,7 @@ impl Command for OverlayHide { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/overlay/list.rs b/crates/nu-cmd-lang/src/core_commands/overlay/list.rs index 776753cba8..d646d63acb 100644 --- a/crates/nu-cmd-lang/src/core_commands/overlay/list.rs +++ b/crates/nu-cmd-lang/src/core_commands/overlay/list.rs @@ -8,7 +8,7 @@ impl Command for OverlayList { "overlay list" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "List all active overlays." } @@ -18,7 +18,7 @@ impl Command for OverlayList { .input_output_types(vec![(Type::Nothing, Type::List(Box::new(Type::String)))]) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "The overlays are listed in the order they were activated." } diff --git a/crates/nu-cmd-lang/src/core_commands/overlay/new.rs b/crates/nu-cmd-lang/src/core_commands/overlay/new.rs index a571c37947..98356971f2 100644 --- a/crates/nu-cmd-lang/src/core_commands/overlay/new.rs +++ b/crates/nu-cmd-lang/src/core_commands/overlay/new.rs @@ -9,7 +9,7 @@ impl Command for OverlayNew { "overlay new" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Create an empty overlay." } @@ -27,7 +27,7 @@ impl Command for OverlayNew { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"The command will first create an empty module, then add it as an overlay. This command is a parser keyword. For details, check: diff --git a/crates/nu-cmd-lang/src/core_commands/overlay/use_.rs b/crates/nu-cmd-lang/src/core_commands/overlay/use_.rs index d6d3ae745a..04cdb7a3da 100644 --- a/crates/nu-cmd-lang/src/core_commands/overlay/use_.rs +++ b/crates/nu-cmd-lang/src/core_commands/overlay/use_.rs @@ -14,7 +14,7 @@ impl Command for OverlayUse { "overlay use" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Use definitions from a module as an overlay." } @@ -45,7 +45,7 @@ impl Command for OverlayUse { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/return_.rs b/crates/nu-cmd-lang/src/core_commands/return_.rs index 478224079b..86863cd3d0 100644 --- a/crates/nu-cmd-lang/src/core_commands/return_.rs +++ b/crates/nu-cmd-lang/src/core_commands/return_.rs @@ -9,7 +9,7 @@ impl Command for Return { "return" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Return early from a function." } @@ -24,7 +24,7 @@ impl Command for Return { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/scope/aliases.rs b/crates/nu-cmd-lang/src/core_commands/scope/aliases.rs index 0b8d2d0200..6e5290a3e1 100644 --- a/crates/nu-cmd-lang/src/core_commands/scope/aliases.rs +++ b/crates/nu-cmd-lang/src/core_commands/scope/aliases.rs @@ -15,7 +15,7 @@ impl Command for ScopeAliases { .category(Category::Core) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Output info on the aliases in the current scope." } diff --git a/crates/nu-cmd-lang/src/core_commands/scope/command.rs b/crates/nu-cmd-lang/src/core_commands/scope/command.rs index cc52a8a16f..5e252c0077 100644 --- a/crates/nu-cmd-lang/src/core_commands/scope/command.rs +++ b/crates/nu-cmd-lang/src/core_commands/scope/command.rs @@ -15,7 +15,7 @@ impl Command for Scope { .allow_variants_without_examples(true) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Commands for getting info about what is in scope." } diff --git a/crates/nu-cmd-lang/src/core_commands/scope/commands.rs b/crates/nu-cmd-lang/src/core_commands/scope/commands.rs index 6ce0448f4e..a1fcd7be82 100644 --- a/crates/nu-cmd-lang/src/core_commands/scope/commands.rs +++ b/crates/nu-cmd-lang/src/core_commands/scope/commands.rs @@ -15,7 +15,7 @@ impl Command for ScopeCommands { .category(Category::Core) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Output info on the commands in the current scope." } diff --git a/crates/nu-cmd-lang/src/core_commands/scope/engine_stats.rs b/crates/nu-cmd-lang/src/core_commands/scope/engine_stats.rs index 649f622cd6..3109ef29a1 100644 --- a/crates/nu-cmd-lang/src/core_commands/scope/engine_stats.rs +++ b/crates/nu-cmd-lang/src/core_commands/scope/engine_stats.rs @@ -15,7 +15,7 @@ impl Command for ScopeEngineStats { .category(Category::Core) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Output stats on the engine in the current state." } diff --git a/crates/nu-cmd-lang/src/core_commands/scope/externs.rs b/crates/nu-cmd-lang/src/core_commands/scope/externs.rs index 187f90206d..fc7980c59e 100644 --- a/crates/nu-cmd-lang/src/core_commands/scope/externs.rs +++ b/crates/nu-cmd-lang/src/core_commands/scope/externs.rs @@ -15,7 +15,7 @@ impl Command for ScopeExterns { .category(Category::Core) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Output info on the known externals in the current scope." } diff --git a/crates/nu-cmd-lang/src/core_commands/scope/modules.rs b/crates/nu-cmd-lang/src/core_commands/scope/modules.rs index 9d78f2a061..1f5ca9e0e9 100644 --- a/crates/nu-cmd-lang/src/core_commands/scope/modules.rs +++ b/crates/nu-cmd-lang/src/core_commands/scope/modules.rs @@ -15,7 +15,7 @@ impl Command for ScopeModules { .category(Category::Core) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Output info on the modules in the current scope." } diff --git a/crates/nu-cmd-lang/src/core_commands/scope/variables.rs b/crates/nu-cmd-lang/src/core_commands/scope/variables.rs index 6c9a695c71..c07eb76230 100644 --- a/crates/nu-cmd-lang/src/core_commands/scope/variables.rs +++ b/crates/nu-cmd-lang/src/core_commands/scope/variables.rs @@ -15,7 +15,7 @@ impl Command for ScopeVariables { .category(Category::Core) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Output info on the variables in the current scope." } diff --git a/crates/nu-cmd-lang/src/core_commands/try_.rs b/crates/nu-cmd-lang/src/core_commands/try_.rs index 2309897a1b..fd2d3bd3cc 100644 --- a/crates/nu-cmd-lang/src/core_commands/try_.rs +++ b/crates/nu-cmd-lang/src/core_commands/try_.rs @@ -9,7 +9,7 @@ impl Command for Try { "try" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Try to run a block, if it fails optionally run a catch closure." } @@ -31,7 +31,7 @@ impl Command for Try { .category(Category::Core) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-lang/src/core_commands/use_.rs b/crates/nu-cmd-lang/src/core_commands/use_.rs index 7f544fa5d4..8035cc81fe 100644 --- a/crates/nu-cmd-lang/src/core_commands/use_.rs +++ b/crates/nu-cmd-lang/src/core_commands/use_.rs @@ -14,7 +14,7 @@ impl Command for Use { "use" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Use definitions from a module, making them available in your shell." } @@ -35,7 +35,7 @@ impl Command for Use { vec!["module", "import", "include", "scope"] } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"See `help std` for the standard library module. See `help modules` to list all available modules. diff --git a/crates/nu-cmd-lang/src/core_commands/version.rs b/crates/nu-cmd-lang/src/core_commands/version.rs index 5491db65fc..f5716be6b3 100644 --- a/crates/nu-cmd-lang/src/core_commands/version.rs +++ b/crates/nu-cmd-lang/src/core_commands/version.rs @@ -21,7 +21,7 @@ impl Command for Version { .category(Category::Core) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Display Nu version, and its build configuration." } diff --git a/crates/nu-cmd-lang/src/core_commands/while_.rs b/crates/nu-cmd-lang/src/core_commands/while_.rs index a67c47fcab..acdac7edef 100644 --- a/crates/nu-cmd-lang/src/core_commands/while_.rs +++ b/crates/nu-cmd-lang/src/core_commands/while_.rs @@ -9,7 +9,7 @@ impl Command for While { "while" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Conditionally run a block in a loop." } @@ -30,7 +30,7 @@ impl Command for While { vec!["loop"] } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-cmd-plugin/src/commands/plugin/add.rs b/crates/nu-cmd-plugin/src/commands/plugin/add.rs index 14f3541168..fa0b599de3 100644 --- a/crates/nu-cmd-plugin/src/commands/plugin/add.rs +++ b/crates/nu-cmd-plugin/src/commands/plugin/add.rs @@ -37,11 +37,11 @@ impl Command for PluginAdd { .category(Category::Plugin) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Add a plugin to the plugin registry file." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#" This does not load the plugin commands into the scope - see `plugin use` for that. diff --git a/crates/nu-cmd-plugin/src/commands/plugin/list.rs b/crates/nu-cmd-plugin/src/commands/plugin/list.rs index 030a3341d6..3fbf55b23c 100644 --- a/crates/nu-cmd-plugin/src/commands/plugin/list.rs +++ b/crates/nu-cmd-plugin/src/commands/plugin/list.rs @@ -29,7 +29,7 @@ impl Command for PluginList { .category(Category::Plugin) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "List installed plugins." } diff --git a/crates/nu-cmd-plugin/src/commands/plugin/mod.rs b/crates/nu-cmd-plugin/src/commands/plugin/mod.rs index 36590e9a8a..ae4e5a7743 100644 --- a/crates/nu-cmd-plugin/src/commands/plugin/mod.rs +++ b/crates/nu-cmd-plugin/src/commands/plugin/mod.rs @@ -26,7 +26,7 @@ impl Command for PluginCommand { .category(Category::Plugin) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Commands for managing plugins." } diff --git a/crates/nu-cmd-plugin/src/commands/plugin/rm.rs b/crates/nu-cmd-plugin/src/commands/plugin/rm.rs index a00060e27a..33557836c0 100644 --- a/crates/nu-cmd-plugin/src/commands/plugin/rm.rs +++ b/crates/nu-cmd-plugin/src/commands/plugin/rm.rs @@ -33,11 +33,11 @@ impl Command for PluginRm { .category(Category::Plugin) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Remove a plugin from the plugin registry file." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#" This does not remove the plugin commands from the current scope or from `plugin list` in the current shell. It instead removes the plugin from the plugin diff --git a/crates/nu-cmd-plugin/src/commands/plugin/stop.rs b/crates/nu-cmd-plugin/src/commands/plugin/stop.rs index f90eac8411..3c8383db93 100644 --- a/crates/nu-cmd-plugin/src/commands/plugin/stop.rs +++ b/crates/nu-cmd-plugin/src/commands/plugin/stop.rs @@ -21,7 +21,7 @@ impl Command for PluginStop { .category(Category::Plugin) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Stop an installed plugin if it was running." } diff --git a/crates/nu-cmd-plugin/src/commands/plugin/use_.rs b/crates/nu-cmd-plugin/src/commands/plugin/use_.rs index 3cfb28f28b..df6ddb4507 100644 --- a/crates/nu-cmd-plugin/src/commands/plugin/use_.rs +++ b/crates/nu-cmd-plugin/src/commands/plugin/use_.rs @@ -9,7 +9,7 @@ impl Command for PluginUse { "plugin use" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Load a plugin from the plugin registry file into scope." } @@ -30,7 +30,7 @@ impl Command for PluginUse { .category(Category::Plugin) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#" This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html diff --git a/crates/nu-command/src/bytes/add.rs b/crates/nu-command/src/bytes/add.rs index ab31f74b12..909a76bcd3 100644 --- a/crates/nu-command/src/bytes/add.rs +++ b/crates/nu-command/src/bytes/add.rs @@ -51,7 +51,7 @@ impl Command for BytesAdd { .category(Category::Bytes) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Add specified bytes to the input." } diff --git a/crates/nu-command/src/bytes/at.rs b/crates/nu-command/src/bytes/at.rs index 5e95f4fd62..adb4bfd9c2 100644 --- a/crates/nu-command/src/bytes/at.rs +++ b/crates/nu-command/src/bytes/at.rs @@ -53,7 +53,7 @@ impl Command for BytesAt { .category(Category::Bytes) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Get bytes defined by a range." } diff --git a/crates/nu-command/src/bytes/build_.rs b/crates/nu-command/src/bytes/build_.rs index 9a3599a071..f9ca58b10f 100644 --- a/crates/nu-command/src/bytes/build_.rs +++ b/crates/nu-command/src/bytes/build_.rs @@ -8,7 +8,7 @@ impl Command for BytesBuild { "bytes build" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Create bytes from the arguments." } diff --git a/crates/nu-command/src/bytes/bytes_.rs b/crates/nu-command/src/bytes/bytes_.rs index 82bf7c619b..5717b9d741 100644 --- a/crates/nu-command/src/bytes/bytes_.rs +++ b/crates/nu-command/src/bytes/bytes_.rs @@ -14,11 +14,11 @@ impl Command for Bytes { .input_output_types(vec![(Type::Nothing, Type::String)]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Various commands for working with byte data." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu-command/src/bytes/collect.rs b/crates/nu-command/src/bytes/collect.rs index afb70bfb36..84089f2961 100644 --- a/crates/nu-command/src/bytes/collect.rs +++ b/crates/nu-command/src/bytes/collect.rs @@ -20,7 +20,7 @@ impl Command for BytesCollect { .category(Category::Bytes) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Concatenate multiple binary into a single binary, with an optional separator between each." } diff --git a/crates/nu-command/src/bytes/ends_with.rs b/crates/nu-command/src/bytes/ends_with.rs index 8e3966716c..774b45aefc 100644 --- a/crates/nu-command/src/bytes/ends_with.rs +++ b/crates/nu-command/src/bytes/ends_with.rs @@ -41,7 +41,7 @@ impl Command for BytesEndsWith { .category(Category::Bytes) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Check if bytes ends with a pattern." } diff --git a/crates/nu-command/src/bytes/index_of.rs b/crates/nu-command/src/bytes/index_of.rs index e10bd6c200..b6e1f4615d 100644 --- a/crates/nu-command/src/bytes/index_of.rs +++ b/crates/nu-command/src/bytes/index_of.rs @@ -47,7 +47,7 @@ impl Command for BytesIndexOf { .category(Category::Bytes) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns start index of first occurrence of pattern in bytes, or -1 if no match." } diff --git a/crates/nu-command/src/bytes/length.rs b/crates/nu-command/src/bytes/length.rs index 78b3d31eac..34a606b784 100644 --- a/crates/nu-command/src/bytes/length.rs +++ b/crates/nu-command/src/bytes/length.rs @@ -29,7 +29,7 @@ impl Command for BytesLen { .category(Category::Bytes) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Output the length of any bytes in the pipeline." } diff --git a/crates/nu-command/src/bytes/remove.rs b/crates/nu-command/src/bytes/remove.rs index 34d3c427f4..df420d044a 100644 --- a/crates/nu-command/src/bytes/remove.rs +++ b/crates/nu-command/src/bytes/remove.rs @@ -40,7 +40,7 @@ impl Command for BytesRemove { .category(Category::Bytes) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Remove bytes." } diff --git a/crates/nu-command/src/bytes/replace.rs b/crates/nu-command/src/bytes/replace.rs index db2b6fb790..a3ef18bdb7 100644 --- a/crates/nu-command/src/bytes/replace.rs +++ b/crates/nu-command/src/bytes/replace.rs @@ -41,7 +41,7 @@ impl Command for BytesReplace { .category(Category::Bytes) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Find and replace binary." } diff --git a/crates/nu-command/src/bytes/reverse.rs b/crates/nu-command/src/bytes/reverse.rs index fd769eaa40..ed988716b4 100644 --- a/crates/nu-command/src/bytes/reverse.rs +++ b/crates/nu-command/src/bytes/reverse.rs @@ -25,7 +25,7 @@ impl Command for BytesReverse { .category(Category::Bytes) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Reverse the bytes in the pipeline." } diff --git a/crates/nu-command/src/bytes/starts_with.rs b/crates/nu-command/src/bytes/starts_with.rs index 89cc4f7afc..39db1a80ce 100644 --- a/crates/nu-command/src/bytes/starts_with.rs +++ b/crates/nu-command/src/bytes/starts_with.rs @@ -39,7 +39,7 @@ impl Command for BytesStartsWith { .category(Category::Bytes) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Check if bytes starts with a pattern." } diff --git a/crates/nu-command/src/charting/histogram.rs b/crates/nu-command/src/charting/histogram.rs index 1162259409..349ec1c2a7 100755 --- a/crates/nu-command/src/charting/histogram.rs +++ b/crates/nu-command/src/charting/histogram.rs @@ -26,7 +26,7 @@ impl Command for Histogram { .category(Category::Chart) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates a new table with a histogram based on the column name passed in." } diff --git a/crates/nu-command/src/conversions/fill.rs b/crates/nu-command/src/conversions/fill.rs index 3bd205814a..4ab284931f 100644 --- a/crates/nu-command/src/conversions/fill.rs +++ b/crates/nu-command/src/conversions/fill.rs @@ -32,7 +32,7 @@ impl Command for Fill { "fill" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Fill and Align." } diff --git a/crates/nu-command/src/conversions/into/binary.rs b/crates/nu-command/src/conversions/into/binary.rs index e5c34ae6bc..d82f911506 100644 --- a/crates/nu-command/src/conversions/into/binary.rs +++ b/crates/nu-command/src/conversions/into/binary.rs @@ -43,7 +43,7 @@ impl Command for SubCommand { .category(Category::Conversions) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert value to a binary primitive." } diff --git a/crates/nu-command/src/conversions/into/bool.rs b/crates/nu-command/src/conversions/into/bool.rs index 0fcd33b4a3..c1af991d95 100644 --- a/crates/nu-command/src/conversions/into/bool.rs +++ b/crates/nu-command/src/conversions/into/bool.rs @@ -29,7 +29,7 @@ impl Command for SubCommand { .category(Category::Conversions) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert value to boolean." } diff --git a/crates/nu-command/src/conversions/into/cell_path.rs b/crates/nu-command/src/conversions/into/cell_path.rs index 1342fb14c0..cd5c7773f6 100644 --- a/crates/nu-command/src/conversions/into/cell_path.rs +++ b/crates/nu-command/src/conversions/into/cell_path.rs @@ -25,7 +25,7 @@ impl Command for IntoCellPath { .allow_variants_without_examples(true) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert value to a cell-path." } @@ -33,7 +33,7 @@ impl Command for IntoCellPath { vec!["convert"] } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "Converting a string directly into a cell path is intentionally not supported." } diff --git a/crates/nu-command/src/conversions/into/command.rs b/crates/nu-command/src/conversions/into/command.rs index 03b8e81c4a..07c74c59f7 100644 --- a/crates/nu-command/src/conversions/into/command.rs +++ b/crates/nu-command/src/conversions/into/command.rs @@ -14,11 +14,11 @@ impl Command for Into { .input_output_types(vec![(Type::Nothing, Type::String)]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Commands to convert data from one type to another." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu-command/src/conversions/into/datetime.rs b/crates/nu-command/src/conversions/into/datetime.rs index 9dd6ad9335..68fcc31420 100644 --- a/crates/nu-command/src/conversions/into/datetime.rs +++ b/crates/nu-command/src/conversions/into/datetime.rs @@ -145,7 +145,7 @@ impl Command for SubCommand { } } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert text or timestamp into a datetime." } diff --git a/crates/nu-command/src/conversions/into/duration.rs b/crates/nu-command/src/conversions/into/duration.rs index b459dd04b1..d11cfeffc2 100644 --- a/crates/nu-command/src/conversions/into/duration.rs +++ b/crates/nu-command/src/conversions/into/duration.rs @@ -36,11 +36,11 @@ impl Command for SubCommand { .category(Category::Conversions) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert value to duration." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "Max duration value is i64::MAX nanoseconds; max duration time unit is wk (weeks)." } diff --git a/crates/nu-command/src/conversions/into/filesize.rs b/crates/nu-command/src/conversions/into/filesize.rs index 5be167e30c..cfbdfc6f37 100644 --- a/crates/nu-command/src/conversions/into/filesize.rs +++ b/crates/nu-command/src/conversions/into/filesize.rs @@ -51,7 +51,7 @@ impl Command for SubCommand { .category(Category::Conversions) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert value to filesize." } diff --git a/crates/nu-command/src/conversions/into/float.rs b/crates/nu-command/src/conversions/into/float.rs index 43556bb5ef..23ada8c5a9 100644 --- a/crates/nu-command/src/conversions/into/float.rs +++ b/crates/nu-command/src/conversions/into/float.rs @@ -32,7 +32,7 @@ impl Command for SubCommand { .category(Category::Conversions) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert data into floating point number." } diff --git a/crates/nu-command/src/conversions/into/glob.rs b/crates/nu-command/src/conversions/into/glob.rs index ffc3655330..9ee8d2a361 100644 --- a/crates/nu-command/src/conversions/into/glob.rs +++ b/crates/nu-command/src/conversions/into/glob.rs @@ -39,7 +39,7 @@ impl Command for SubCommand { .category(Category::Conversions) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert value to glob." } diff --git a/crates/nu-command/src/conversions/into/int.rs b/crates/nu-command/src/conversions/into/int.rs index d4bfa61639..0792719fef 100644 --- a/crates/nu-command/src/conversions/into/int.rs +++ b/crates/nu-command/src/conversions/into/int.rs @@ -89,7 +89,7 @@ impl Command for SubCommand { .category(Category::Conversions) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert value to integer." } diff --git a/crates/nu-command/src/conversions/into/record.rs b/crates/nu-command/src/conversions/into/record.rs index ed86c5848e..6290739060 100644 --- a/crates/nu-command/src/conversions/into/record.rs +++ b/crates/nu-command/src/conversions/into/record.rs @@ -21,7 +21,7 @@ impl Command for SubCommand { .category(Category::Conversions) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert value to record." } diff --git a/crates/nu-command/src/conversions/into/string.rs b/crates/nu-command/src/conversions/into/string.rs index 2b35272b3e..b116de9752 100644 --- a/crates/nu-command/src/conversions/into/string.rs +++ b/crates/nu-command/src/conversions/into/string.rs @@ -60,7 +60,7 @@ impl Command for SubCommand { .category(Category::Conversions) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert value to string." } diff --git a/crates/nu-command/src/conversions/into/value.rs b/crates/nu-command/src/conversions/into/value.rs index e8787e75bb..cd919ca8d6 100644 --- a/crates/nu-command/src/conversions/into/value.rs +++ b/crates/nu-command/src/conversions/into/value.rs @@ -31,7 +31,7 @@ impl Command for IntoValue { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Infer nushell datatype for each cell." } diff --git a/crates/nu-command/src/database/commands/into_sqlite.rs b/crates/nu-command/src/database/commands/into_sqlite.rs index 88a6114ab3..fcfa228f3b 100644 --- a/crates/nu-command/src/database/commands/into_sqlite.rs +++ b/crates/nu-command/src/database/commands/into_sqlite.rs @@ -46,7 +46,7 @@ impl Command for IntoSqliteDb { operate(engine_state, stack, call, input) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert table into a SQLite database." } diff --git a/crates/nu-command/src/database/commands/query_db.rs b/crates/nu-command/src/database/commands/query_db.rs index 6a132e2698..a70a11c6ae 100644 --- a/crates/nu-command/src/database/commands/query_db.rs +++ b/crates/nu-command/src/database/commands/query_db.rs @@ -27,7 +27,7 @@ impl Command for QueryDb { .category(Category::Database) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Query a database using SQL." } diff --git a/crates/nu-command/src/database/commands/schema.rs b/crates/nu-command/src/database/commands/schema.rs index ab7b36dab2..5663d7748a 100644 --- a/crates/nu-command/src/database/commands/schema.rs +++ b/crates/nu-command/src/database/commands/schema.rs @@ -17,7 +17,7 @@ impl Command for SchemaDb { .category(Category::Database) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Show the schema of a SQLite database." } diff --git a/crates/nu-command/src/date/date_.rs b/crates/nu-command/src/date/date_.rs index fd67e9c923..f404c62fed 100644 --- a/crates/nu-command/src/date/date_.rs +++ b/crates/nu-command/src/date/date_.rs @@ -14,11 +14,11 @@ impl Command for Date { .input_output_types(vec![(Type::Nothing, Type::String)]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Date-related commands." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu-command/src/date/humanize.rs b/crates/nu-command/src/date/humanize.rs index d8542a540c..3f3300a94d 100644 --- a/crates/nu-command/src/date/humanize.rs +++ b/crates/nu-command/src/date/humanize.rs @@ -21,7 +21,7 @@ impl Command for SubCommand { .category(Category::Date) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Print a 'humanized' format for the date, relative to now." } diff --git a/crates/nu-command/src/date/list_timezone.rs b/crates/nu-command/src/date/list_timezone.rs index 56f7fe5376..6b7c448af2 100644 --- a/crates/nu-command/src/date/list_timezone.rs +++ b/crates/nu-command/src/date/list_timezone.rs @@ -15,7 +15,7 @@ impl Command for SubCommand { .category(Category::Date) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "List supported time zones." } diff --git a/crates/nu-command/src/date/now.rs b/crates/nu-command/src/date/now.rs index adc75e3760..5492db9863 100644 --- a/crates/nu-command/src/date/now.rs +++ b/crates/nu-command/src/date/now.rs @@ -15,7 +15,7 @@ impl Command for SubCommand { .category(Category::Date) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Get the current date." } diff --git a/crates/nu-command/src/date/to_record.rs b/crates/nu-command/src/date/to_record.rs index c0b09c040b..f683ca1eec 100644 --- a/crates/nu-command/src/date/to_record.rs +++ b/crates/nu-command/src/date/to_record.rs @@ -20,7 +20,7 @@ impl Command for SubCommand { .category(Category::Date) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert the date into a record." } diff --git a/crates/nu-command/src/date/to_table.rs b/crates/nu-command/src/date/to_table.rs index 7ce8bc171b..1588d40063 100644 --- a/crates/nu-command/src/date/to_table.rs +++ b/crates/nu-command/src/date/to_table.rs @@ -20,7 +20,7 @@ impl Command for SubCommand { .category(Category::Date) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert the date into a structured table." } diff --git a/crates/nu-command/src/date/to_timezone.rs b/crates/nu-command/src/date/to_timezone.rs index 3d08d7271b..e5e354f9cc 100644 --- a/crates/nu-command/src/date/to_timezone.rs +++ b/crates/nu-command/src/date/to_timezone.rs @@ -19,11 +19,11 @@ impl Command for SubCommand { .category(Category::Date) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert a date to a given time zone." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "Use 'date list-timezone' to list all supported time zones." } diff --git a/crates/nu-command/src/debug/ast.rs b/crates/nu-command/src/debug/ast.rs index ef28d5a205..c6e405d533 100644 --- a/crates/nu-command/src/debug/ast.rs +++ b/crates/nu-command/src/debug/ast.rs @@ -10,7 +10,7 @@ impl Command for Ast { "ast" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Print the abstract syntax tree (ast) for a pipeline." } diff --git a/crates/nu-command/src/debug/debug_.rs b/crates/nu-command/src/debug/debug_.rs index 80a9067e49..8ce3407c89 100644 --- a/crates/nu-command/src/debug/debug_.rs +++ b/crates/nu-command/src/debug/debug_.rs @@ -8,7 +8,7 @@ impl Command for Debug { "debug" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Debug print the value(s) piped in." } diff --git a/crates/nu-command/src/debug/explain.rs b/crates/nu-command/src/debug/explain.rs index 710e37935a..dc68b283e6 100644 --- a/crates/nu-command/src/debug/explain.rs +++ b/crates/nu-command/src/debug/explain.rs @@ -12,7 +12,7 @@ impl Command for Explain { "explain" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Explain closure contents." } diff --git a/crates/nu-command/src/debug/info.rs b/crates/nu-command/src/debug/info.rs index 76317ed866..da4689738e 100644 --- a/crates/nu-command/src/debug/info.rs +++ b/crates/nu-command/src/debug/info.rs @@ -20,11 +20,11 @@ impl Command for DebugInfo { "debug info" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "View process memory info." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "This command is meant for debugging purposes.\nIt shows you the process information and system memory information." } diff --git a/crates/nu-command/src/debug/inspect.rs b/crates/nu-command/src/debug/inspect.rs index ad6163c7b6..97217780bf 100644 --- a/crates/nu-command/src/debug/inspect.rs +++ b/crates/nu-command/src/debug/inspect.rs @@ -10,7 +10,7 @@ impl Command for Inspect { "inspect" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Inspect pipeline results while running a pipeline." } diff --git a/crates/nu-command/src/debug/metadata.rs b/crates/nu-command/src/debug/metadata.rs index 245c150cea..c9b48bb79a 100644 --- a/crates/nu-command/src/debug/metadata.rs +++ b/crates/nu-command/src/debug/metadata.rs @@ -12,7 +12,7 @@ impl Command for Metadata { "metadata" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Get the metadata for items in the stream." } diff --git a/crates/nu-command/src/debug/metadata_set.rs b/crates/nu-command/src/debug/metadata_set.rs index c78a5df5c3..6274de7544 100644 --- a/crates/nu-command/src/debug/metadata_set.rs +++ b/crates/nu-command/src/debug/metadata_set.rs @@ -9,7 +9,7 @@ impl Command for MetadataSet { "metadata set" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Set the metadata for items in the stream." } diff --git a/crates/nu-command/src/debug/profile.rs b/crates/nu-command/src/debug/profile.rs index e8254563df..41eee4c183 100644 --- a/crates/nu-command/src/debug/profile.rs +++ b/crates/nu-command/src/debug/profile.rs @@ -43,11 +43,11 @@ impl Command for DebugProfile { .category(Category::Debug) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Profile pipeline elements in a closure." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"The profiler profiles every evaluated pipeline element inside a closure, stepping into all commands calls and other blocks/closures. diff --git a/crates/nu-command/src/debug/timeit.rs b/crates/nu-command/src/debug/timeit.rs index 7a48644a6d..08de95dcd2 100644 --- a/crates/nu-command/src/debug/timeit.rs +++ b/crates/nu-command/src/debug/timeit.rs @@ -9,7 +9,7 @@ impl Command for TimeIt { "timeit" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Time the running time of a block." } diff --git a/crates/nu-command/src/debug/view.rs b/crates/nu-command/src/debug/view.rs index 4ef1c1c7e0..b849a1bb0f 100644 --- a/crates/nu-command/src/debug/view.rs +++ b/crates/nu-command/src/debug/view.rs @@ -14,11 +14,11 @@ impl Command for View { .input_output_types(vec![(Type::Nothing, Type::String)]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Various commands for viewing debug information." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu-command/src/debug/view_files.rs b/crates/nu-command/src/debug/view_files.rs index 4f4effc6f2..1b48166036 100644 --- a/crates/nu-command/src/debug/view_files.rs +++ b/crates/nu-command/src/debug/view_files.rs @@ -8,11 +8,11 @@ impl Command for ViewFiles { "view files" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "View the files registered in nushell's EngineState memory." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "These are files parsed and loaded at runtime." } diff --git a/crates/nu-command/src/debug/view_ir.rs b/crates/nu-command/src/debug/view_ir.rs index 72136079fd..676285844c 100644 --- a/crates/nu-command/src/debug/view_ir.rs +++ b/crates/nu-command/src/debug/view_ir.rs @@ -29,11 +29,11 @@ impl Command for ViewIr { .category(Category::Debug) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "View the compiled IR code for a block of code." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { " The target can be a closure, the name of a custom command, or an internal block ID. Closure literals within IR dumps often reference the block by ID (e.g. diff --git a/crates/nu-command/src/debug/view_source.rs b/crates/nu-command/src/debug/view_source.rs index 54bca55956..b0163c3bd1 100644 --- a/crates/nu-command/src/debug/view_source.rs +++ b/crates/nu-command/src/debug/view_source.rs @@ -11,7 +11,7 @@ impl Command for ViewSource { "view source" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "View a block, module, or a definition." } diff --git a/crates/nu-command/src/debug/view_span.rs b/crates/nu-command/src/debug/view_span.rs index abf8e622b1..017cae62cf 100644 --- a/crates/nu-command/src/debug/view_span.rs +++ b/crates/nu-command/src/debug/view_span.rs @@ -8,11 +8,11 @@ impl Command for ViewSpan { "view span" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "View the contents of a span." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "This command is meant for debugging purposes.\nIt allows you to view the contents of nushell spans.\nOne way to get spans is to pipe something into 'debug --raw'.\nThen you can use the Span { start, end } values as the start and end values for this command." } diff --git a/crates/nu-command/src/env/config/config_.rs b/crates/nu-command/src/env/config/config_.rs index 1cd6ef4621..207c8c8651 100644 --- a/crates/nu-command/src/env/config/config_.rs +++ b/crates/nu-command/src/env/config/config_.rs @@ -14,11 +14,11 @@ impl Command for ConfigMeta { .input_output_types(vec![(Type::Nothing, Type::String)]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Edit nushell configuration files." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu-command/src/env/config/config_env.rs b/crates/nu-command/src/env/config/config_env.rs index 777b6f3aac..cb4a217d9b 100644 --- a/crates/nu-command/src/env/config/config_env.rs +++ b/crates/nu-command/src/env/config/config_env.rs @@ -19,7 +19,7 @@ impl Command for ConfigEnv { // TODO: Signature narrower than what run actually supports theoretically } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Edit nu environment configurations." } diff --git a/crates/nu-command/src/env/config/config_nu.rs b/crates/nu-command/src/env/config/config_nu.rs index 80f0bbc012..9969968ed2 100644 --- a/crates/nu-command/src/env/config/config_nu.rs +++ b/crates/nu-command/src/env/config/config_nu.rs @@ -23,7 +23,7 @@ impl Command for ConfigNu { // TODO: Signature narrower than what run actually supports theoretically } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Edit nu configurations." } diff --git a/crates/nu-command/src/env/config/config_reset.rs b/crates/nu-command/src/env/config/config_reset.rs index 9a97285240..a185072d67 100644 --- a/crates/nu-command/src/env/config/config_reset.rs +++ b/crates/nu-command/src/env/config/config_reset.rs @@ -22,7 +22,7 @@ impl Command for ConfigReset { .category(Category::Env) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Reset nushell environment configurations to default, and saves old config files in the config location as oldconfig.nu and oldenv.nu." } diff --git a/crates/nu-command/src/env/export_env.rs b/crates/nu-command/src/env/export_env.rs index 7b583c9959..7c0072b5d4 100644 --- a/crates/nu-command/src/env/export_env.rs +++ b/crates/nu-command/src/env/export_env.rs @@ -20,11 +20,11 @@ impl Command for ExportEnv { .category(Category::Env) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Run a block and preserve its environment in a current scope." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-command/src/env/load_env.rs b/crates/nu-command/src/env/load_env.rs index 38311430ef..f35b1d08ea 100644 --- a/crates/nu-command/src/env/load_env.rs +++ b/crates/nu-command/src/env/load_env.rs @@ -8,7 +8,7 @@ impl Command for LoadEnv { "load-env" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Loads an environment update from a record." } diff --git a/crates/nu-command/src/env/source_env.rs b/crates/nu-command/src/env/source_env.rs index 1813a92f1f..9768c4619f 100644 --- a/crates/nu-command/src/env/source_env.rs +++ b/crates/nu-command/src/env/source_env.rs @@ -25,11 +25,11 @@ impl Command for SourceEnv { .category(Category::Core) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Source the environment from a source file into the current environment." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-command/src/env/with_env.rs b/crates/nu-command/src/env/with_env.rs index 46f7d1eb6e..dc21fcdf93 100644 --- a/crates/nu-command/src/env/with_env.rs +++ b/crates/nu-command/src/env/with_env.rs @@ -25,7 +25,7 @@ impl Command for WithEnv { .category(Category::Env) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Runs a block with an environment variable set." } diff --git a/crates/nu-command/src/experimental/is_admin.rs b/crates/nu-command/src/experimental/is_admin.rs index f6a2efef0a..2dbeb0e988 100644 --- a/crates/nu-command/src/experimental/is_admin.rs +++ b/crates/nu-command/src/experimental/is_admin.rs @@ -8,7 +8,7 @@ impl Command for IsAdmin { "is-admin" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Check if nushell is running with administrator or root privileges." } diff --git a/crates/nu-command/src/filesystem/cd.rs b/crates/nu-command/src/filesystem/cd.rs index 87071d2888..cd968a05a5 100644 --- a/crates/nu-command/src/filesystem/cd.rs +++ b/crates/nu-command/src/filesystem/cd.rs @@ -10,7 +10,7 @@ impl Command for Cd { "cd" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Change directory." } diff --git a/crates/nu-command/src/filesystem/du.rs b/crates/nu-command/src/filesystem/du.rs index d34892ace9..6ae07974b9 100644 --- a/crates/nu-command/src/filesystem/du.rs +++ b/crates/nu-command/src/filesystem/du.rs @@ -27,7 +27,7 @@ impl Command for Du { "du" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Find disk usage sizes of specified items." } diff --git a/crates/nu-command/src/filesystem/glob.rs b/crates/nu-command/src/filesystem/glob.rs index faba600c94..d6243bbc32 100644 --- a/crates/nu-command/src/filesystem/glob.rs +++ b/crates/nu-command/src/filesystem/glob.rs @@ -44,7 +44,7 @@ impl Command for Glob { .category(Category::FileSystem) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates a list of files and/or folders based on the glob pattern provided." } @@ -114,7 +114,7 @@ impl Command for Glob { ] } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"For more glob pattern help, please refer to https://docs.rs/crate/wax/latest"# } diff --git a/crates/nu-command/src/filesystem/ls.rs b/crates/nu-command/src/filesystem/ls.rs index 445bf0f425..d198816727 100644 --- a/crates/nu-command/src/filesystem/ls.rs +++ b/crates/nu-command/src/filesystem/ls.rs @@ -38,7 +38,7 @@ impl Command for Ls { "ls" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "List the filenames, sizes, and modification times of items in a directory." } diff --git a/crates/nu-command/src/filesystem/mktemp.rs b/crates/nu-command/src/filesystem/mktemp.rs index cbe67e65ce..9a0c041f15 100644 --- a/crates/nu-command/src/filesystem/mktemp.rs +++ b/crates/nu-command/src/filesystem/mktemp.rs @@ -10,7 +10,7 @@ impl Command for Mktemp { "mktemp" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Create temporary files or directories using uutils/coreutils mktemp." } diff --git a/crates/nu-command/src/filesystem/open.rs b/crates/nu-command/src/filesystem/open.rs index 23e95d1aed..ea2a253a2a 100644 --- a/crates/nu-command/src/filesystem/open.rs +++ b/crates/nu-command/src/filesystem/open.rs @@ -18,11 +18,11 @@ impl Command for Open { "open" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Load a file into a cell, converting to table if possible (avoid by appending '--raw')." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "Support to automatically parse files with an extension `.xyz` can be provided by a `from xyz` command in scope." } diff --git a/crates/nu-command/src/filesystem/rm.rs b/crates/nu-command/src/filesystem/rm.rs index 9e879cb2ad..2e5b964a7e 100644 --- a/crates/nu-command/src/filesystem/rm.rs +++ b/crates/nu-command/src/filesystem/rm.rs @@ -25,7 +25,7 @@ impl Command for Rm { "rm" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Remove files and directories." } diff --git a/crates/nu-command/src/filesystem/save.rs b/crates/nu-command/src/filesystem/save.rs index 619e7d0b2b..1b6ddd5982 100644 --- a/crates/nu-command/src/filesystem/save.rs +++ b/crates/nu-command/src/filesystem/save.rs @@ -22,7 +22,7 @@ impl Command for Save { "save" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Save a file." } diff --git a/crates/nu-command/src/filesystem/start.rs b/crates/nu-command/src/filesystem/start.rs index 87aa34cf72..577fe128ba 100644 --- a/crates/nu-command/src/filesystem/start.rs +++ b/crates/nu-command/src/filesystem/start.rs @@ -15,7 +15,7 @@ impl Command for Start { "start" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Open a folder, file or website in the default application or viewer." } diff --git a/crates/nu-command/src/filesystem/touch.rs b/crates/nu-command/src/filesystem/touch.rs index a3e5bc40f1..9085554bb4 100644 --- a/crates/nu-command/src/filesystem/touch.rs +++ b/crates/nu-command/src/filesystem/touch.rs @@ -51,7 +51,7 @@ impl Command for Touch { .category(Category::FileSystem) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates one or more files." } diff --git a/crates/nu-command/src/filesystem/ucp.rs b/crates/nu-command/src/filesystem/ucp.rs index 6077278c18..3bc7f13325 100644 --- a/crates/nu-command/src/filesystem/ucp.rs +++ b/crates/nu-command/src/filesystem/ucp.rs @@ -20,7 +20,7 @@ impl Command for UCp { "cp" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Copy files using uutils/coreutils cp." } diff --git a/crates/nu-command/src/filesystem/umkdir.rs b/crates/nu-command/src/filesystem/umkdir.rs index 7565beee5e..6f4c77ef1b 100644 --- a/crates/nu-command/src/filesystem/umkdir.rs +++ b/crates/nu-command/src/filesystem/umkdir.rs @@ -28,7 +28,7 @@ impl Command for UMkdir { "mkdir" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Create directories, with intermediary directories if required using uutils/coreutils mkdir." } diff --git a/crates/nu-command/src/filesystem/umv.rs b/crates/nu-command/src/filesystem/umv.rs index 9f68a6697f..0f49a7d97d 100644 --- a/crates/nu-command/src/filesystem/umv.rs +++ b/crates/nu-command/src/filesystem/umv.rs @@ -14,7 +14,7 @@ impl Command for UMv { "mv" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Move files or directories using uutils/coreutils mv." } diff --git a/crates/nu-command/src/filesystem/watch.rs b/crates/nu-command/src/filesystem/watch.rs index e6d86357b8..5138af354e 100644 --- a/crates/nu-command/src/filesystem/watch.rs +++ b/crates/nu-command/src/filesystem/watch.rs @@ -28,7 +28,7 @@ impl Command for Watch { "watch" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Watch for file changes and execute Nu code when they happen." } diff --git a/crates/nu-command/src/filters/all.rs b/crates/nu-command/src/filters/all.rs index 648454eb07..e4ffdf2c87 100644 --- a/crates/nu-command/src/filters/all.rs +++ b/crates/nu-command/src/filters/all.rs @@ -20,7 +20,7 @@ impl Command for All { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Test if every element of the input fulfills a predicate expression." } diff --git a/crates/nu-command/src/filters/any.rs b/crates/nu-command/src/filters/any.rs index 87d7887b48..cd8a6b65e4 100644 --- a/crates/nu-command/src/filters/any.rs +++ b/crates/nu-command/src/filters/any.rs @@ -20,7 +20,7 @@ impl Command for Any { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Tests if any element of the input fulfills a predicate expression." } diff --git a/crates/nu-command/src/filters/append.rs b/crates/nu-command/src/filters/append.rs index 2064bdf1e8..7aab2bedcd 100644 --- a/crates/nu-command/src/filters/append.rs +++ b/crates/nu-command/src/filters/append.rs @@ -20,11 +20,11 @@ impl Command for Append { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Append any number of rows to a table." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"Be aware that this command 'unwraps' lists passed to it. So, if you pass a variable to it, and you want the variable's contents to be appended without being unwrapped, it's wise to pre-emptively wrap the variable in a list, like so: `append [$val]`. This way, `append` will diff --git a/crates/nu-command/src/filters/chunks.rs b/crates/nu-command/src/filters/chunks.rs index 68d682ecd1..4db436ca25 100644 --- a/crates/nu-command/src/filters/chunks.rs +++ b/crates/nu-command/src/filters/chunks.rs @@ -20,11 +20,11 @@ impl Command for Chunks { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Divide a list or table into chunks of `chunk_size`." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "This command will error if `chunk_size` is negative or zero." } diff --git a/crates/nu-command/src/filters/columns.rs b/crates/nu-command/src/filters/columns.rs index da8bc5ae57..e0d5b273a8 100644 --- a/crates/nu-command/src/filters/columns.rs +++ b/crates/nu-command/src/filters/columns.rs @@ -17,11 +17,11 @@ impl Command for Columns { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Given a record or table, produce a list of its columns' names." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "This is a counterpart to `values`, which produces a list of columns' values." } diff --git a/crates/nu-command/src/filters/compact.rs b/crates/nu-command/src/filters/compact.rs index f43d738ed1..7481d668e0 100644 --- a/crates/nu-command/src/filters/compact.rs +++ b/crates/nu-command/src/filters/compact.rs @@ -27,7 +27,7 @@ impl Command for Compact { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates a table with non-empty rows." } diff --git a/crates/nu-command/src/filters/default.rs b/crates/nu-command/src/filters/default.rs index e269c58ccd..6e5610f1be 100644 --- a/crates/nu-command/src/filters/default.rs +++ b/crates/nu-command/src/filters/default.rs @@ -26,7 +26,7 @@ impl Command for Default { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Sets a default value if a row's column is missing or null." } diff --git a/crates/nu-command/src/filters/drop/column.rs b/crates/nu-command/src/filters/drop/column.rs index f168e6c2ca..f39e0e2276 100644 --- a/crates/nu-command/src/filters/drop/column.rs +++ b/crates/nu-command/src/filters/drop/column.rs @@ -24,7 +24,7 @@ impl Command for DropColumn { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Remove N columns at the right-hand end of the input table. To remove columns by name, use `reject`." } diff --git a/crates/nu-command/src/filters/drop/drop_.rs b/crates/nu-command/src/filters/drop/drop_.rs index ba78058261..67abea625d 100644 --- a/crates/nu-command/src/filters/drop/drop_.rs +++ b/crates/nu-command/src/filters/drop/drop_.rs @@ -21,7 +21,7 @@ impl Command for Drop { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Remove items/rows from the end of the input list/table. Counterpart of `skip`. Opposite of `last`." } diff --git a/crates/nu-command/src/filters/drop/nth.rs b/crates/nu-command/src/filters/drop/nth.rs index a76c4f0d92..d2aed50332 100644 --- a/crates/nu-command/src/filters/drop/nth.rs +++ b/crates/nu-command/src/filters/drop/nth.rs @@ -27,7 +27,7 @@ impl Command for DropNth { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Drop the selected rows." } diff --git a/crates/nu-command/src/filters/each.rs b/crates/nu-command/src/filters/each.rs index a7035917b3..e1407c3ce1 100644 --- a/crates/nu-command/src/filters/each.rs +++ b/crates/nu-command/src/filters/each.rs @@ -10,11 +10,11 @@ impl Command for Each { "each" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Run a closure on each row of the input list, creating a new list with the results." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"Since tables are lists of records, passing a table into 'each' will iterate over each record, not necessarily each cell within it. diff --git a/crates/nu-command/src/filters/enumerate.rs b/crates/nu-command/src/filters/enumerate.rs index df0f4e2fca..f5182b3456 100644 --- a/crates/nu-command/src/filters/enumerate.rs +++ b/crates/nu-command/src/filters/enumerate.rs @@ -8,7 +8,7 @@ impl Command for Enumerate { "enumerate" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Enumerate the elements in a stream." } diff --git a/crates/nu-command/src/filters/every.rs b/crates/nu-command/src/filters/every.rs index 664be33bed..65d121435d 100644 --- a/crates/nu-command/src/filters/every.rs +++ b/crates/nu-command/src/filters/every.rs @@ -27,7 +27,7 @@ impl Command for Every { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Show (or skip) every n-th row, starting from the first one." } diff --git a/crates/nu-command/src/filters/filter.rs b/crates/nu-command/src/filters/filter.rs index f2efaa3af3..93fe5a6e6d 100644 --- a/crates/nu-command/src/filters/filter.rs +++ b/crates/nu-command/src/filters/filter.rs @@ -10,11 +10,11 @@ impl Command for Filter { "filter" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Filter values based on a predicate closure." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command works similar to 'where' but allows reading the predicate closure from a variable. On the other hand, the "row condition" syntax is not supported."# } diff --git a/crates/nu-command/src/filters/find.rs b/crates/nu-command/src/filters/find.rs index 9ed0c28a3c..78a84274ab 100644 --- a/crates/nu-command/src/filters/find.rs +++ b/crates/nu-command/src/filters/find.rs @@ -57,7 +57,7 @@ impl Command for Find { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Searches terms in the input." } diff --git a/crates/nu-command/src/filters/first.rs b/crates/nu-command/src/filters/first.rs index 8f2e8db1b9..5695f823c7 100644 --- a/crates/nu-command/src/filters/first.rs +++ b/crates/nu-command/src/filters/first.rs @@ -31,7 +31,7 @@ impl Command for First { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Return only the first several rows of the input. Counterpart of `last`. Opposite of `skip`." } diff --git a/crates/nu-command/src/filters/flatten.rs b/crates/nu-command/src/filters/flatten.rs index b4faec9589..3e285d21aa 100644 --- a/crates/nu-command/src/filters/flatten.rs +++ b/crates/nu-command/src/filters/flatten.rs @@ -28,7 +28,7 @@ impl Command for Flatten { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Flatten the table." } diff --git a/crates/nu-command/src/filters/get.rs b/crates/nu-command/src/filters/get.rs index 9f7d76277d..a79c1c48f4 100644 --- a/crates/nu-command/src/filters/get.rs +++ b/crates/nu-command/src/filters/get.rs @@ -8,11 +8,11 @@ impl Command for Get { "get" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Extract data using a cell path." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This is equivalent to using the cell path access syntax: `$env.OS` is the same as `$env | get OS`. If multiple cell paths are given, this will produce a list of values."# diff --git a/crates/nu-command/src/filters/group.rs b/crates/nu-command/src/filters/group.rs index 60c720e325..5327cad610 100644 --- a/crates/nu-command/src/filters/group.rs +++ b/crates/nu-command/src/filters/group.rs @@ -23,7 +23,7 @@ impl Command for Group { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Groups input into groups of `group_size`." } diff --git a/crates/nu-command/src/filters/group_by.rs b/crates/nu-command/src/filters/group_by.rs index c1d76ebe08..78789c606a 100644 --- a/crates/nu-command/src/filters/group_by.rs +++ b/crates/nu-command/src/filters/group_by.rs @@ -34,7 +34,7 @@ impl Command for GroupBy { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Splits a list or table into groups, and returns a record containing those groups." } diff --git a/crates/nu-command/src/filters/headers.rs b/crates/nu-command/src/filters/headers.rs index 6e63c33ff9..1a9de5367e 100644 --- a/crates/nu-command/src/filters/headers.rs +++ b/crates/nu-command/src/filters/headers.rs @@ -22,7 +22,7 @@ impl Command for Headers { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Use the first row of the table as column names." } diff --git a/crates/nu-command/src/filters/insert.rs b/crates/nu-command/src/filters/insert.rs index 3b47c4e6a9..e6f9a7d8d7 100644 --- a/crates/nu-command/src/filters/insert.rs +++ b/crates/nu-command/src/filters/insert.rs @@ -33,11 +33,11 @@ impl Command for Insert { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Insert a new column, using an expression or closure to create each row's values." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "When inserting a column, the closure will be run for each row, and the current row will be passed as the first argument. When inserting into a specific index, the closure will instead get the current value at the index or null if inserting at the end of a list/table." } diff --git a/crates/nu-command/src/filters/interleave.rs b/crates/nu-command/src/filters/interleave.rs index 9890fede1e..f31a3411ae 100644 --- a/crates/nu-command/src/filters/interleave.rs +++ b/crates/nu-command/src/filters/interleave.rs @@ -10,11 +10,11 @@ impl Command for Interleave { "interleave" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Read multiple streams in parallel and combine them into one stream." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This combinator is useful for reading output from multiple commands. If input is provided to `interleave`, the input will be combined with the diff --git a/crates/nu-command/src/filters/is_empty.rs b/crates/nu-command/src/filters/is_empty.rs index d18f3d4ceb..5a2781b52e 100644 --- a/crates/nu-command/src/filters/is_empty.rs +++ b/crates/nu-command/src/filters/is_empty.rs @@ -20,7 +20,7 @@ impl Command for IsEmpty { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Check for empty values." } diff --git a/crates/nu-command/src/filters/is_not_empty.rs b/crates/nu-command/src/filters/is_not_empty.rs index 6d97e3612d..6b1ffbe643 100644 --- a/crates/nu-command/src/filters/is_not_empty.rs +++ b/crates/nu-command/src/filters/is_not_empty.rs @@ -20,7 +20,7 @@ impl Command for IsNotEmpty { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Check for non-empty values." } diff --git a/crates/nu-command/src/filters/items.rs b/crates/nu-command/src/filters/items.rs index fa7b680afd..a32f2808b8 100644 --- a/crates/nu-command/src/filters/items.rs +++ b/crates/nu-command/src/filters/items.rs @@ -22,11 +22,11 @@ impl Command for Items { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Given a record, iterate on each pair of column name and associated value." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "This is a the fusion of `columns`, `values` and `each`." } diff --git a/crates/nu-command/src/filters/join.rs b/crates/nu-command/src/filters/join.rs index f5e6d63deb..379366d4c9 100644 --- a/crates/nu-command/src/filters/join.rs +++ b/crates/nu-command/src/filters/join.rs @@ -50,7 +50,7 @@ impl Command for Join { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Join two tables." } diff --git a/crates/nu-command/src/filters/last.rs b/crates/nu-command/src/filters/last.rs index bb5a75fecd..127833dcd4 100644 --- a/crates/nu-command/src/filters/last.rs +++ b/crates/nu-command/src/filters/last.rs @@ -29,7 +29,7 @@ impl Command for Last { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Return only the last several rows of the input. Counterpart of `first`. Opposite of `drop`." } diff --git a/crates/nu-command/src/filters/length.rs b/crates/nu-command/src/filters/length.rs index cced0a9515..cd64e7a5ed 100644 --- a/crates/nu-command/src/filters/length.rs +++ b/crates/nu-command/src/filters/length.rs @@ -8,7 +8,7 @@ impl Command for Length { "length" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Count the number of items in an input list or rows in a table." } diff --git a/crates/nu-command/src/filters/lines.rs b/crates/nu-command/src/filters/lines.rs index fc957e1c0e..6527e73f1d 100644 --- a/crates/nu-command/src/filters/lines.rs +++ b/crates/nu-command/src/filters/lines.rs @@ -8,7 +8,7 @@ impl Command for Lines { "lines" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Converts input to lines." } diff --git a/crates/nu-command/src/filters/merge.rs b/crates/nu-command/src/filters/merge.rs index 191ed1706c..fa8ec9d337 100644 --- a/crates/nu-command/src/filters/merge.rs +++ b/crates/nu-command/src/filters/merge.rs @@ -8,11 +8,11 @@ impl Command for Merge { "merge" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Merge the input with a record or table, overwriting values in matching columns." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"You may provide a column structure to merge When merging tables, row 0 of the input table is overwritten diff --git a/crates/nu-command/src/filters/move_.rs b/crates/nu-command/src/filters/move_.rs index 6e826af050..83130e8150 100644 --- a/crates/nu-command/src/filters/move_.rs +++ b/crates/nu-command/src/filters/move_.rs @@ -14,7 +14,7 @@ impl Command for Move { "move" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Move columns before or after other columns." } diff --git a/crates/nu-command/src/filters/par_each.rs b/crates/nu-command/src/filters/par_each.rs index 958a7fbc76..fc0da7d3d3 100644 --- a/crates/nu-command/src/filters/par_each.rs +++ b/crates/nu-command/src/filters/par_each.rs @@ -11,7 +11,7 @@ impl Command for ParEach { "par-each" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Run a closure on each row of the input list in parallel, creating a new list with the results." } diff --git a/crates/nu-command/src/filters/prepend.rs b/crates/nu-command/src/filters/prepend.rs index eeae0ef656..0a7e3d08fa 100644 --- a/crates/nu-command/src/filters/prepend.rs +++ b/crates/nu-command/src/filters/prepend.rs @@ -19,11 +19,11 @@ impl Command for Prepend { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Prepend any number of rows to a table." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"Be aware that this command 'unwraps' lists passed to it. So, if you pass a variable to it, and you want the variable's contents to be prepended without being unwrapped, it's wise to pre-emptively wrap the variable in a list, like so: `prepend [$val]`. This way, `prepend` will diff --git a/crates/nu-command/src/filters/range.rs b/crates/nu-command/src/filters/range.rs index 0d4e703bb1..d2a539b9ad 100644 --- a/crates/nu-command/src/filters/range.rs +++ b/crates/nu-command/src/filters/range.rs @@ -20,7 +20,7 @@ impl Command for Range { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Return only the selected rows." } diff --git a/crates/nu-command/src/filters/reduce.rs b/crates/nu-command/src/filters/reduce.rs index ffd2e850d9..ed3c61ec32 100644 --- a/crates/nu-command/src/filters/reduce.rs +++ b/crates/nu-command/src/filters/reduce.rs @@ -35,7 +35,7 @@ impl Command for Reduce { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Aggregate a list (starting from the left) to a single value using an accumulator closure." } diff --git a/crates/nu-command/src/filters/reject.rs b/crates/nu-command/src/filters/reject.rs index f8583d3f47..3f966e2da5 100644 --- a/crates/nu-command/src/filters/reject.rs +++ b/crates/nu-command/src/filters/reject.rs @@ -29,11 +29,11 @@ impl Command for Reject { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Remove the given columns or rows from the table. Opposite of `select`." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "To remove a quantity of rows or columns, use `skip`, `drop`, or `drop column`." } diff --git a/crates/nu-command/src/filters/rename.rs b/crates/nu-command/src/filters/rename.rs index 1e7ce34028..174d8d43ae 100644 --- a/crates/nu-command/src/filters/rename.rs +++ b/crates/nu-command/src/filters/rename.rs @@ -36,7 +36,7 @@ impl Command for Rename { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates a new table with columns renamed." } diff --git a/crates/nu-command/src/filters/reverse.rs b/crates/nu-command/src/filters/reverse.rs index 18891637ab..f3c4d32353 100644 --- a/crates/nu-command/src/filters/reverse.rs +++ b/crates/nu-command/src/filters/reverse.rs @@ -17,7 +17,7 @@ impl Command for Reverse { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Reverses the input list or table." } diff --git a/crates/nu-command/src/filters/select.rs b/crates/nu-command/src/filters/select.rs index 2fe4da3c36..45b965861e 100644 --- a/crates/nu-command/src/filters/select.rs +++ b/crates/nu-command/src/filters/select.rs @@ -32,11 +32,11 @@ impl Command for Select { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Select only these columns or rows from the input. Opposite of `reject`." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This differs from `get` in that, rather than accessing the given value in the data structure, it removes all non-selected values from the structure. Hence, using `select` on a table will produce a table, a list will produce a list, and a record will produce a record."# diff --git a/crates/nu-command/src/filters/shuffle.rs b/crates/nu-command/src/filters/shuffle.rs index ec4bf8c454..35e64f8ce7 100644 --- a/crates/nu-command/src/filters/shuffle.rs +++ b/crates/nu-command/src/filters/shuffle.rs @@ -18,7 +18,7 @@ impl Command for Shuffle { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Shuffle rows randomly." } diff --git a/crates/nu-command/src/filters/skip/skip_.rs b/crates/nu-command/src/filters/skip/skip_.rs index b64f438858..fade5a00ba 100644 --- a/crates/nu-command/src/filters/skip/skip_.rs +++ b/crates/nu-command/src/filters/skip/skip_.rs @@ -24,11 +24,11 @@ impl Command for Skip { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Skip the first several rows of the input. Counterpart of `drop`. Opposite of `first`." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"To skip specific numbered rows, try `drop nth`. To skip specific named columns, try `reject`."# } diff --git a/crates/nu-command/src/filters/skip/skip_until.rs b/crates/nu-command/src/filters/skip/skip_until.rs index 72cae739af..b73c817e9b 100644 --- a/crates/nu-command/src/filters/skip/skip_until.rs +++ b/crates/nu-command/src/filters/skip/skip_until.rs @@ -26,7 +26,7 @@ impl Command for SkipUntil { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Skip elements of the input until a predicate is true." } diff --git a/crates/nu-command/src/filters/skip/skip_while.rs b/crates/nu-command/src/filters/skip/skip_while.rs index ea9c12bf6a..9423915242 100644 --- a/crates/nu-command/src/filters/skip/skip_while.rs +++ b/crates/nu-command/src/filters/skip/skip_while.rs @@ -26,7 +26,7 @@ impl Command for SkipWhile { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Skip elements of the input while a predicate is true." } diff --git a/crates/nu-command/src/filters/sort.rs b/crates/nu-command/src/filters/sort.rs index 179235302d..aae00037c4 100644 --- a/crates/nu-command/src/filters/sort.rs +++ b/crates/nu-command/src/filters/sort.rs @@ -37,7 +37,7 @@ impl Command for Sort { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Sort in increasing order." } diff --git a/crates/nu-command/src/filters/sort_by.rs b/crates/nu-command/src/filters/sort_by.rs index e832255a26..440c16f490 100644 --- a/crates/nu-command/src/filters/sort_by.rs +++ b/crates/nu-command/src/filters/sort_by.rs @@ -34,7 +34,7 @@ impl Command for SortBy { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Sort by the given columns, in increasing order." } diff --git a/crates/nu-command/src/filters/split_by.rs b/crates/nu-command/src/filters/split_by.rs index 419119fe0c..7a5898e608 100644 --- a/crates/nu-command/src/filters/split_by.rs +++ b/crates/nu-command/src/filters/split_by.rs @@ -16,7 +16,7 @@ impl Command for SplitBy { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Split a record into groups." } diff --git a/crates/nu-command/src/filters/take/take_.rs b/crates/nu-command/src/filters/take/take_.rs index 1876244bdd..85a94fcd4b 100644 --- a/crates/nu-command/src/filters/take/take_.rs +++ b/crates/nu-command/src/filters/take/take_.rs @@ -29,7 +29,7 @@ impl Command for Take { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Take only the first n elements of a list, or the first n bytes of a binary value." } diff --git a/crates/nu-command/src/filters/take/take_until.rs b/crates/nu-command/src/filters/take/take_until.rs index c8544d364a..e1dcd6ceda 100644 --- a/crates/nu-command/src/filters/take/take_until.rs +++ b/crates/nu-command/src/filters/take/take_until.rs @@ -23,7 +23,7 @@ impl Command for TakeUntil { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Take elements of the input until a predicate is true." } diff --git a/crates/nu-command/src/filters/take/take_while.rs b/crates/nu-command/src/filters/take/take_while.rs index b8045080ea..54e9384cba 100644 --- a/crates/nu-command/src/filters/take/take_while.rs +++ b/crates/nu-command/src/filters/take/take_while.rs @@ -26,7 +26,7 @@ impl Command for TakeWhile { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Take elements of the input while a predicate is true." } diff --git a/crates/nu-command/src/filters/tee.rs b/crates/nu-command/src/filters/tee.rs index 663b2f19af..4e801bfcc8 100644 --- a/crates/nu-command/src/filters/tee.rs +++ b/crates/nu-command/src/filters/tee.rs @@ -17,11 +17,11 @@ impl Command for Tee { "tee" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Copy a stream to another command in parallel." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This is useful for doing something else with a stream while still continuing to use it in your pipeline."# } diff --git a/crates/nu-command/src/filters/transpose.rs b/crates/nu-command/src/filters/transpose.rs index 4a14c1aea2..2ca6958199 100644 --- a/crates/nu-command/src/filters/transpose.rs +++ b/crates/nu-command/src/filters/transpose.rs @@ -57,7 +57,7 @@ impl Command for Transpose { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Transposes the table contents so rows become columns and columns become rows." } diff --git a/crates/nu-command/src/filters/uniq.rs b/crates/nu-command/src/filters/uniq.rs index 99abb4e152..a22d62b89e 100644 --- a/crates/nu-command/src/filters/uniq.rs +++ b/crates/nu-command/src/filters/uniq.rs @@ -41,7 +41,7 @@ impl Command for Uniq { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Return the distinct values in the input." } diff --git a/crates/nu-command/src/filters/uniq_by.rs b/crates/nu-command/src/filters/uniq_by.rs index e1a502b06b..c092cfe6b4 100644 --- a/crates/nu-command/src/filters/uniq_by.rs +++ b/crates/nu-command/src/filters/uniq_by.rs @@ -43,7 +43,7 @@ impl Command for UniqBy { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Return the distinct values in the input by the given column(s)." } diff --git a/crates/nu-command/src/filters/update.rs b/crates/nu-command/src/filters/update.rs index d5ef0825ec..9d1d152d1e 100644 --- a/crates/nu-command/src/filters/update.rs +++ b/crates/nu-command/src/filters/update.rs @@ -33,11 +33,11 @@ impl Command for Update { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Update an existing column to have a new value." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "When updating a column, the closure will be run for each row, and the current row will be passed as the first argument. \ Referencing `$in` inside the closure will provide the value at the column for the current row. diff --git a/crates/nu-command/src/filters/upsert.rs b/crates/nu-command/src/filters/upsert.rs index af2e6c74b1..a85e98f639 100644 --- a/crates/nu-command/src/filters/upsert.rs +++ b/crates/nu-command/src/filters/upsert.rs @@ -33,11 +33,11 @@ impl Command for Upsert { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Update an existing column to have a new value, or insert a new column." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "When updating or inserting a column, the closure will be run for each row, and the current row will be passed as the first argument. \ Referencing `$in` inside the closure will provide the value at the column for the current row or null if the column does not exist. diff --git a/crates/nu-command/src/filters/values.rs b/crates/nu-command/src/filters/values.rs index 9a08f1168c..5039938055 100644 --- a/crates/nu-command/src/filters/values.rs +++ b/crates/nu-command/src/filters/values.rs @@ -18,11 +18,11 @@ impl Command for Values { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Given a record or table, produce a list of its columns' values." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "This is a counterpart to `columns`, which produces a list of columns' names." } diff --git a/crates/nu-command/src/filters/where_.rs b/crates/nu-command/src/filters/where_.rs index 0a8c8c9ef3..cf40639172 100644 --- a/crates/nu-command/src/filters/where_.rs +++ b/crates/nu-command/src/filters/where_.rs @@ -9,11 +9,11 @@ impl Command for Where { "where" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Filter values based on a row condition." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command works similar to 'filter' but allows extra shorthands for working with tables, known as "row conditions". On the other hand, reading the condition from a variable is not supported."# diff --git a/crates/nu-command/src/filters/window.rs b/crates/nu-command/src/filters/window.rs index 556543118b..65ce2b0aee 100644 --- a/crates/nu-command/src/filters/window.rs +++ b/crates/nu-command/src/filters/window.rs @@ -31,11 +31,11 @@ impl Command for Window { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates a sliding window of `window_size` that slide by n rows/elements across input." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "This command will error if `window_size` or `stride` are negative or zero." } diff --git a/crates/nu-command/src/filters/wrap.rs b/crates/nu-command/src/filters/wrap.rs index dfe1c11d03..6988c09f9a 100644 --- a/crates/nu-command/src/filters/wrap.rs +++ b/crates/nu-command/src/filters/wrap.rs @@ -8,7 +8,7 @@ impl Command for Wrap { "wrap" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Wrap the value into a column." } diff --git a/crates/nu-command/src/filters/zip.rs b/crates/nu-command/src/filters/zip.rs index 59e2b4ac98..14e3d57ddd 100644 --- a/crates/nu-command/src/filters/zip.rs +++ b/crates/nu-command/src/filters/zip.rs @@ -8,7 +8,7 @@ impl Command for Zip { "zip" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Combine a stream with the input." } diff --git a/crates/nu-command/src/formats/from/command.rs b/crates/nu-command/src/formats/from/command.rs index 40085b51d2..864e22615c 100644 --- a/crates/nu-command/src/formats/from/command.rs +++ b/crates/nu-command/src/formats/from/command.rs @@ -8,7 +8,7 @@ impl Command for From { "from" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Parse a string or binary data into structured data." } @@ -18,7 +18,7 @@ impl Command for From { .input_output_types(vec![(Type::Nothing, Type::String)]) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu-command/src/formats/from/csv.rs b/crates/nu-command/src/formats/from/csv.rs index b00dd5022b..472ccf4d71 100644 --- a/crates/nu-command/src/formats/from/csv.rs +++ b/crates/nu-command/src/formats/from/csv.rs @@ -56,7 +56,7 @@ impl Command for FromCsv { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Parse text as .csv and create table." } diff --git a/crates/nu-command/src/formats/from/json.rs b/crates/nu-command/src/formats/from/json.rs index 6d46df78a3..e3de2cbafd 100644 --- a/crates/nu-command/src/formats/from/json.rs +++ b/crates/nu-command/src/formats/from/json.rs @@ -11,7 +11,7 @@ impl Command for FromJson { "from json" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert from json to structured data." } diff --git a/crates/nu-command/src/formats/from/msgpack.rs b/crates/nu-command/src/formats/from/msgpack.rs index d3d0d710f1..a3538ea69f 100644 --- a/crates/nu-command/src/formats/from/msgpack.rs +++ b/crates/nu-command/src/formats/from/msgpack.rs @@ -31,11 +31,11 @@ impl Command for FromMsgpack { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert MessagePack data into Nu values." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#" Not all values are representable as MessagePack. diff --git a/crates/nu-command/src/formats/from/msgpackz.rs b/crates/nu-command/src/formats/from/msgpackz.rs index c98b72cdd6..81cc901614 100644 --- a/crates/nu-command/src/formats/from/msgpackz.rs +++ b/crates/nu-command/src/formats/from/msgpackz.rs @@ -21,11 +21,11 @@ impl Command for FromMsgpackz { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert brotli-compressed MessagePack data into Nu values." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "This is the format used by the plugin registry file ($nu.plugin-path)." } diff --git a/crates/nu-command/src/formats/from/nuon.rs b/crates/nu-command/src/formats/from/nuon.rs index bfffe7e5b4..107ee9c3b4 100644 --- a/crates/nu-command/src/formats/from/nuon.rs +++ b/crates/nu-command/src/formats/from/nuon.rs @@ -8,7 +8,7 @@ impl Command for FromNuon { "from nuon" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert from nuon to structured data." } diff --git a/crates/nu-command/src/formats/from/ods.rs b/crates/nu-command/src/formats/from/ods.rs index ff7a76c0ca..c6f08f4481 100644 --- a/crates/nu-command/src/formats/from/ods.rs +++ b/crates/nu-command/src/formats/from/ods.rs @@ -25,7 +25,7 @@ impl Command for FromOds { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Parse OpenDocument Spreadsheet(.ods) data and create table." } diff --git a/crates/nu-command/src/formats/from/ssv.rs b/crates/nu-command/src/formats/from/ssv.rs index 1d17dfc69d..48fb0515cf 100644 --- a/crates/nu-command/src/formats/from/ssv.rs +++ b/crates/nu-command/src/formats/from/ssv.rs @@ -29,7 +29,7 @@ impl Command for FromSsv { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Parse text as space-separated values and create a table. The default minimum number of spaces counted as a separator is 2." } diff --git a/crates/nu-command/src/formats/from/toml.rs b/crates/nu-command/src/formats/from/toml.rs index 266911f50a..a61ced65a0 100644 --- a/crates/nu-command/src/formats/from/toml.rs +++ b/crates/nu-command/src/formats/from/toml.rs @@ -15,7 +15,7 @@ impl Command for FromToml { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Parse text as .toml and create record." } diff --git a/crates/nu-command/src/formats/from/tsv.rs b/crates/nu-command/src/formats/from/tsv.rs index ea507ab1c7..cd3c9f97bd 100644 --- a/crates/nu-command/src/formats/from/tsv.rs +++ b/crates/nu-command/src/formats/from/tsv.rs @@ -50,7 +50,7 @@ impl Command for FromTsv { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Parse text as .tsv and create table." } diff --git a/crates/nu-command/src/formats/from/xlsx.rs b/crates/nu-command/src/formats/from/xlsx.rs index 21e2567b45..1e02cf432c 100644 --- a/crates/nu-command/src/formats/from/xlsx.rs +++ b/crates/nu-command/src/formats/from/xlsx.rs @@ -26,7 +26,7 @@ impl Command for FromXlsx { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Parse binary Excel(.xlsx) data and create table." } diff --git a/crates/nu-command/src/formats/from/xml.rs b/crates/nu-command/src/formats/from/xml.rs index c3464e7a25..4c0675a109 100644 --- a/crates/nu-command/src/formats/from/xml.rs +++ b/crates/nu-command/src/formats/from/xml.rs @@ -24,11 +24,11 @@ impl Command for FromXml { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Parse text as .xml and create record." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"Every XML entry is represented via a record with tag, attribute and content fields. To represent different types of entries different values are written to this fields: 1. Tag entry: `{tag: attrs: {: "" ...} content: []}` diff --git a/crates/nu-command/src/formats/from/yaml.rs b/crates/nu-command/src/formats/from/yaml.rs index 74914ed0c8..5c463cc2a9 100644 --- a/crates/nu-command/src/formats/from/yaml.rs +++ b/crates/nu-command/src/formats/from/yaml.rs @@ -17,7 +17,7 @@ impl Command for FromYaml { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Parse text as .yaml/.yml and create table." } @@ -51,7 +51,7 @@ impl Command for FromYml { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Parse text as .yaml/.yml and create table." } diff --git a/crates/nu-command/src/formats/to/command.rs b/crates/nu-command/src/formats/to/command.rs index 2138085c87..a687d480ba 100644 --- a/crates/nu-command/src/formats/to/command.rs +++ b/crates/nu-command/src/formats/to/command.rs @@ -8,7 +8,7 @@ impl Command for To { "to" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Translate structured data to a format." } @@ -18,7 +18,7 @@ impl Command for To { .input_output_types(vec![(Type::Nothing, Type::String)]) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu-command/src/formats/to/csv.rs b/crates/nu-command/src/formats/to/csv.rs index c5847abd6a..4e971a3abb 100644 --- a/crates/nu-command/src/formats/to/csv.rs +++ b/crates/nu-command/src/formats/to/csv.rs @@ -65,7 +65,7 @@ impl Command for ToCsv { ] } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert table into .csv text ." } diff --git a/crates/nu-command/src/formats/to/json.rs b/crates/nu-command/src/formats/to/json.rs index 729fe2293f..dc2b89c0c9 100644 --- a/crates/nu-command/src/formats/to/json.rs +++ b/crates/nu-command/src/formats/to/json.rs @@ -28,7 +28,7 @@ impl Command for ToJson { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Converts table data into JSON text." } diff --git a/crates/nu-command/src/formats/to/md.rs b/crates/nu-command/src/formats/to/md.rs index 7f86c5eb06..2cf6b5215e 100644 --- a/crates/nu-command/src/formats/to/md.rs +++ b/crates/nu-command/src/formats/to/md.rs @@ -27,7 +27,7 @@ impl Command for ToMd { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert table into simple Markdown." } diff --git a/crates/nu-command/src/formats/to/msgpack.rs b/crates/nu-command/src/formats/to/msgpack.rs index 049b4de86d..b4f7c7d79e 100644 --- a/crates/nu-command/src/formats/to/msgpack.rs +++ b/crates/nu-command/src/formats/to/msgpack.rs @@ -25,11 +25,11 @@ impl Command for ToMsgpack { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert Nu values into MessagePack." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#" Not all values are representable as MessagePack. diff --git a/crates/nu-command/src/formats/to/msgpackz.rs b/crates/nu-command/src/formats/to/msgpackz.rs index 83d812cab6..e4166b15d3 100644 --- a/crates/nu-command/src/formats/to/msgpackz.rs +++ b/crates/nu-command/src/formats/to/msgpackz.rs @@ -34,11 +34,11 @@ impl Command for ToMsgpackz { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert Nu values into brotli-compressed MessagePack." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "This is the format used by the plugin registry file ($nu.plugin-path)." } diff --git a/crates/nu-command/src/formats/to/nuon.rs b/crates/nu-command/src/formats/to/nuon.rs index 809ddc01ad..db29934a4d 100644 --- a/crates/nu-command/src/formats/to/nuon.rs +++ b/crates/nu-command/src/formats/to/nuon.rs @@ -31,7 +31,7 @@ impl Command for ToNuon { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Converts table data into Nuon (Nushell Object Notation) text." } diff --git a/crates/nu-command/src/formats/to/text.rs b/crates/nu-command/src/formats/to/text.rs index 111c42cdff..626596ea76 100644 --- a/crates/nu-command/src/formats/to/text.rs +++ b/crates/nu-command/src/formats/to/text.rs @@ -24,7 +24,7 @@ impl Command for ToText { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Converts data into simple text." } diff --git a/crates/nu-command/src/formats/to/toml.rs b/crates/nu-command/src/formats/to/toml.rs index c70864b7f8..9e5728ef1e 100644 --- a/crates/nu-command/src/formats/to/toml.rs +++ b/crates/nu-command/src/formats/to/toml.rs @@ -16,7 +16,7 @@ impl Command for ToToml { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert record into .toml text." } diff --git a/crates/nu-command/src/formats/to/tsv.rs b/crates/nu-command/src/formats/to/tsv.rs index 63f72f4584..1afe18ea48 100644 --- a/crates/nu-command/src/formats/to/tsv.rs +++ b/crates/nu-command/src/formats/to/tsv.rs @@ -34,7 +34,7 @@ impl Command for ToTsv { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert table into .tsv text." } diff --git a/crates/nu-command/src/formats/to/xml.rs b/crates/nu-command/src/formats/to/xml.rs index 1285c558ee..0df986d082 100644 --- a/crates/nu-command/src/formats/to/xml.rs +++ b/crates/nu-command/src/formats/to/xml.rs @@ -38,7 +38,7 @@ impl Command for ToXml { .category(Category::Formats) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"Every XML entry is represented via a record with tag, attribute and content fields. To represent different types of entries different values must be written to this fields: 1. Tag entry: `{tag: attributes: {: "" ...} content: []}` @@ -89,7 +89,7 @@ Additionally any field which is: empty record, empty list or null, can be omitte ] } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert special record structure into .xml text." } diff --git a/crates/nu-command/src/formats/to/yaml.rs b/crates/nu-command/src/formats/to/yaml.rs index ae923c1fc8..c5de035e42 100644 --- a/crates/nu-command/src/formats/to/yaml.rs +++ b/crates/nu-command/src/formats/to/yaml.rs @@ -15,7 +15,7 @@ impl Command for ToYaml { .category(Category::Formats) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert table into .yaml/.yml text." } diff --git a/crates/nu-command/src/generators/cal.rs b/crates/nu-command/src/generators/cal.rs index 018d9370dd..30430955b1 100644 --- a/crates/nu-command/src/generators/cal.rs +++ b/crates/nu-command/src/generators/cal.rs @@ -54,7 +54,7 @@ impl Command for Cal { .category(Category::Generators) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Display a calendar." } diff --git a/crates/nu-command/src/generators/generate.rs b/crates/nu-command/src/generators/generate.rs index 2b2cf838f4..ead6bdd7c9 100644 --- a/crates/nu-command/src/generators/generate.rs +++ b/crates/nu-command/src/generators/generate.rs @@ -22,11 +22,11 @@ impl Command for Generate { .category(Category::Generators) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Generate a list of values by successively invoking a closure." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"The generator closure accepts a single argument and returns a record containing two optional keys: 'out' and 'next'. Each invocation, the 'out' value, if present, is added to the stream. If a 'next' key is present, it is diff --git a/crates/nu-command/src/generators/seq.rs b/crates/nu-command/src/generators/seq.rs index 3636d89d4c..48eab645b9 100644 --- a/crates/nu-command/src/generators/seq.rs +++ b/crates/nu-command/src/generators/seq.rs @@ -16,7 +16,7 @@ impl Command for Seq { .category(Category::Generators) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Output sequences of numbers." } diff --git a/crates/nu-command/src/generators/seq_char.rs b/crates/nu-command/src/generators/seq_char.rs index 2b297b53a0..c0f16593d7 100644 --- a/crates/nu-command/src/generators/seq_char.rs +++ b/crates/nu-command/src/generators/seq_char.rs @@ -8,7 +8,7 @@ impl Command for SeqChar { "seq char" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Print a sequence of ASCII characters." } diff --git a/crates/nu-command/src/generators/seq_date.rs b/crates/nu-command/src/generators/seq_date.rs index 7ae1c514c7..955de5a507 100644 --- a/crates/nu-command/src/generators/seq_date.rs +++ b/crates/nu-command/src/generators/seq_date.rs @@ -11,7 +11,7 @@ impl Command for SeqDate { "seq date" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Print sequences of dates." } diff --git a/crates/nu-command/src/hash/generic_digest.rs b/crates/nu-command/src/hash/generic_digest.rs index f098f8a0cb..e94d484840 100644 --- a/crates/nu-command/src/hash/generic_digest.rs +++ b/crates/nu-command/src/hash/generic_digest.rs @@ -10,7 +10,7 @@ pub trait HashDigest: digest::Digest + Clone { #[derive(Clone)] pub struct GenericDigest { name: String, - usage: String, + description: String, phantom: PhantomData, } @@ -18,7 +18,7 @@ impl Default for GenericDigest { fn default() -> Self { Self { name: format!("hash {}", D::name()), - usage: format!("Hash a value using the {} hash algorithm.", D::name()), + description: format!("Hash a value using the {} hash algorithm.", D::name()), phantom: PhantomData, } } @@ -65,8 +65,8 @@ where ) } - fn usage(&self) -> &str { - &self.usage + fn description(&self) -> &str { + &self.description } fn examples(&self) -> Vec> { diff --git a/crates/nu-command/src/hash/hash_.rs b/crates/nu-command/src/hash/hash_.rs index d4eca79354..b16ee950bc 100644 --- a/crates/nu-command/src/hash/hash_.rs +++ b/crates/nu-command/src/hash/hash_.rs @@ -14,11 +14,11 @@ impl Command for Hash { .input_output_types(vec![(Type::Nothing, Type::String)]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Apply hash function." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu-command/src/help/help_.rs b/crates/nu-command/src/help/help_.rs index 9835a20ad0..488095d62c 100644 --- a/crates/nu-command/src/help/help_.rs +++ b/crates/nu-command/src/help/help_.rs @@ -23,17 +23,17 @@ impl Command for Help { .named( "find", SyntaxShape::String, - "string to find in command names, usage, and search terms", + "string to find in command names, descriptions, and search terms", Some('f'), ) .category(Category::Core) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Display help information about different parts of Nushell." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"`help word` searches for "word" in commands, aliases and modules, in that order."# } @@ -118,7 +118,7 @@ You can also learn more at https://www.nushell.sh/book/"#; result: None, }, Example { - description: "search for string in command names, usage and search terms", + description: "search for string in command names, descriptions, and search terms", example: "help --find char", result: None, }, diff --git a/crates/nu-command/src/help/help_aliases.rs b/crates/nu-command/src/help/help_aliases.rs index 41af9da0b3..0d6d4b4f15 100644 --- a/crates/nu-command/src/help/help_aliases.rs +++ b/crates/nu-command/src/help/help_aliases.rs @@ -10,7 +10,7 @@ impl Command for HelpAliases { "help aliases" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Show help on nushell aliases." } @@ -25,7 +25,7 @@ impl Command for HelpAliases { .named( "find", SyntaxShape::String, - "string to find in alias names and usage", + "string to find in alias names and descriptions", Some('f'), ) .input_output_types(vec![(Type::Nothing, Type::table())]) @@ -45,7 +45,7 @@ impl Command for HelpAliases { result: None, }, Example { - description: "search for string in alias names and usages", + description: "search for string in alias names and descriptions", example: "help aliases --find my-alias", result: None, }, @@ -86,7 +86,7 @@ pub fn help_aliases( let found_cmds_vec = highlight_search_in_table( all_cmds_vec, &f.item, - &["name", "usage"], + &["name", "description"], &string_style, &highlight_style, )?; @@ -121,8 +121,8 @@ pub fn help_aliases( let alias_expansion = String::from_utf8_lossy(engine_state.get_span_contents(alias.wrapped_call.span)); - let usage = alias.usage(); - let extra_usage = alias.extra_usage(); + let description = alias.description(); + let extra_desc = alias.extra_description(); // TODO: merge this into documentation.rs at some point const G: &str = "\x1b[32m"; // green @@ -131,11 +131,11 @@ pub fn help_aliases( let mut long_desc = String::new(); - long_desc.push_str(usage); + long_desc.push_str(description); long_desc.push_str("\n\n"); - if !extra_usage.is_empty() { - long_desc.push_str(extra_usage); + if !extra_desc.is_empty() { + long_desc.push_str(extra_desc); long_desc.push_str("\n\n"); } diff --git a/crates/nu-command/src/help/help_commands.rs b/crates/nu-command/src/help/help_commands.rs index f067a9fdcb..d7571b9c07 100644 --- a/crates/nu-command/src/help/help_commands.rs +++ b/crates/nu-command/src/help/help_commands.rs @@ -10,7 +10,7 @@ impl Command for HelpCommands { "help commands" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Show help on nushell commands." } @@ -25,7 +25,7 @@ impl Command for HelpCommands { .named( "find", SyntaxShape::String, - "string to find in command names, usage, and search terms", + "string to find in command names, descriptions, and search terms", Some('f'), ) .input_output_types(vec![(Type::Nothing, Type::table())]) @@ -66,7 +66,7 @@ pub fn help_commands( let found_cmds_vec = highlight_search_in_table( all_cmds_vec, &f.item, - &["name", "usage", "search_terms"], + &["name", "description", "search_terms"], &string_style, &highlight_style, )?; @@ -119,7 +119,7 @@ fn build_help_commands(engine_state: &EngineState, span: Span) -> Vec { let sig = decl.signature().update_from_command(decl); let key = sig.name; - let usage = sig.usage; + let description = sig.description; let search_terms = sig.search_terms; let command_type = decl.command_type().to_string(); @@ -216,7 +216,7 @@ fn build_help_commands(engine_state: &EngineState, span: Span) -> Vec { "name" => Value::string(key, span), "category" => Value::string(sig.category.to_string(), span), "command_type" => Value::string(command_type, span), - "usage" => Value::string(usage, span), + "description" => Value::string(description, span), "params" => param_table, "input_output" => input_output_table, "search_terms" => Value::string(search_terms.join(", "), span), diff --git a/crates/nu-command/src/help/help_escapes.rs b/crates/nu-command/src/help/help_escapes.rs index 212cbb58bf..ecdcca694e 100644 --- a/crates/nu-command/src/help/help_escapes.rs +++ b/crates/nu-command/src/help/help_escapes.rs @@ -8,7 +8,7 @@ impl Command for HelpEscapes { "help escapes" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Show help on nushell string escapes." } diff --git a/crates/nu-command/src/help/help_externs.rs b/crates/nu-command/src/help/help_externs.rs index 4a5c8123a4..af07835af4 100644 --- a/crates/nu-command/src/help/help_externs.rs +++ b/crates/nu-command/src/help/help_externs.rs @@ -10,7 +10,7 @@ impl Command for HelpExterns { "help externs" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Show help on nushell externs." } @@ -25,7 +25,7 @@ impl Command for HelpExterns { .named( "find", SyntaxShape::String, - "string to find in extern names and usage", + "string to find in extern names and descriptions", Some('f'), ) .input_output_types(vec![(Type::Nothing, Type::table())]) @@ -45,7 +45,7 @@ impl Command for HelpExterns { result: None, }, Example { - description: "search for string in extern names and usages", + description: "search for string in extern names and descriptions", example: "help externs --find smth", result: None, }, @@ -86,7 +86,7 @@ pub fn help_externs( let found_cmds_vec = highlight_search_in_table( all_cmds_vec, &f.item, - &["name", "usage"], + &["name", "description"], &string_style, &highlight_style, )?; diff --git a/crates/nu-command/src/help/help_modules.rs b/crates/nu-command/src/help/help_modules.rs index c2c00cf400..579bd3f768 100644 --- a/crates/nu-command/src/help/help_modules.rs +++ b/crates/nu-command/src/help/help_modules.rs @@ -11,11 +11,11 @@ impl Command for HelpModules { "help modules" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Show help on nushell modules." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"When requesting help for a single module, its commands and aliases will be highlighted if they are also available in the current scope. Commands/aliases that were imported under a different name (such as with a prefix after `use some-module`) will be highlighted in parentheses."# @@ -32,7 +32,7 @@ are also available in the current scope. Commands/aliases that were imported und .named( "find", SyntaxShape::String, - "string to find in module names and usage", + "string to find in module names and descriptions", Some('f'), ) .input_output_types(vec![(Type::Nothing, Type::table())]) @@ -52,7 +52,7 @@ are also available in the current scope. Commands/aliases that were imported und result: None, }, Example { - description: "search for string in module names and usages", + description: "search for string in module names and descriptions", example: "help modules --find my-module", result: None, }, @@ -93,7 +93,7 @@ pub fn help_modules( let found_cmds_vec = highlight_search_in_table( all_cmds_vec, &f.item, - &["name", "usage"], + &["name", "description"], &string_style, &highlight_style, )?; @@ -123,7 +123,7 @@ pub fn help_modules( let module = engine_state.get_module(module_id); - let module_usage = engine_state.build_module_usage(module_id); + let module_desc = engine_state.build_module_desc(module_id); // TODO: merge this into documentation.rs at some point const G: &str = "\x1b[32m"; // green @@ -133,12 +133,12 @@ pub fn help_modules( let mut long_desc = String::new(); - if let Some((usage, extra_usage)) = module_usage { - long_desc.push_str(&usage); + if let Some((desc, extra_desc)) = module_desc { + long_desc.push_str(&desc); long_desc.push_str("\n\n"); - if !extra_usage.is_empty() { - long_desc.push_str(&extra_usage); + if !extra_desc.is_empty() { + long_desc.push_str(&extra_desc); long_desc.push_str("\n\n"); } } diff --git a/crates/nu-command/src/help/help_operators.rs b/crates/nu-command/src/help/help_operators.rs index 12803fad8e..28be6a68ed 100644 --- a/crates/nu-command/src/help/help_operators.rs +++ b/crates/nu-command/src/help/help_operators.rs @@ -9,7 +9,7 @@ impl Command for HelpOperators { "help operators" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Show help on nushell operators." } diff --git a/crates/nu-command/src/math/abs.rs b/crates/nu-command/src/math/abs.rs index 86e913e3ee..95cf251abb 100644 --- a/crates/nu-command/src/math/abs.rs +++ b/crates/nu-command/src/math/abs.rs @@ -26,7 +26,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the absolute value of a number." } diff --git a/crates/nu-command/src/math/avg.rs b/crates/nu-command/src/math/avg.rs index fbc2aa327c..07e2ed00bf 100644 --- a/crates/nu-command/src/math/avg.rs +++ b/crates/nu-command/src/math/avg.rs @@ -30,7 +30,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the average of a list of numbers." } diff --git a/crates/nu-command/src/math/ceil.rs b/crates/nu-command/src/math/ceil.rs index 6a98e6da91..a971ef3975 100644 --- a/crates/nu-command/src/math/ceil.rs +++ b/crates/nu-command/src/math/ceil.rs @@ -21,7 +21,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the ceil of a number (smallest integer greater than or equal to that number)." } diff --git a/crates/nu-command/src/math/floor.rs b/crates/nu-command/src/math/floor.rs index cfd7a60981..2dfa293b24 100644 --- a/crates/nu-command/src/math/floor.rs +++ b/crates/nu-command/src/math/floor.rs @@ -21,7 +21,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the floor of a number (largest integer less than or equal to that number)." } diff --git a/crates/nu-command/src/math/log.rs b/crates/nu-command/src/math/log.rs index 0ac967b3b2..4c262017ca 100644 --- a/crates/nu-command/src/math/log.rs +++ b/crates/nu-command/src/math/log.rs @@ -26,7 +26,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the logarithm for an arbitrary base." } diff --git a/crates/nu-command/src/math/math_.rs b/crates/nu-command/src/math/math_.rs index 2ac067af4e..cab773016d 100644 --- a/crates/nu-command/src/math/math_.rs +++ b/crates/nu-command/src/math/math_.rs @@ -14,11 +14,11 @@ impl Command for MathCommand { .input_output_types(vec![(Type::Nothing, Type::String)]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Use mathematical functions as aggregate functions on a list of numbers or tables." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu-command/src/math/max.rs b/crates/nu-command/src/math/max.rs index ce88f4d244..2ee7f89b15 100644 --- a/crates/nu-command/src/math/max.rs +++ b/crates/nu-command/src/math/max.rs @@ -27,7 +27,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the maximum of a list of values, or of columns in a table." } diff --git a/crates/nu-command/src/math/median.rs b/crates/nu-command/src/math/median.rs index eeb3b4a199..653ebb59ba 100644 --- a/crates/nu-command/src/math/median.rs +++ b/crates/nu-command/src/math/median.rs @@ -24,7 +24,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Computes the median of a list of numbers." } diff --git a/crates/nu-command/src/math/min.rs b/crates/nu-command/src/math/min.rs index 4998a93a15..6722575579 100644 --- a/crates/nu-command/src/math/min.rs +++ b/crates/nu-command/src/math/min.rs @@ -27,7 +27,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Finds the minimum within a list of values or tables." } diff --git a/crates/nu-command/src/math/mode.rs b/crates/nu-command/src/math/mode.rs index 6890e3f5b4..b89896ca88 100644 --- a/crates/nu-command/src/math/mode.rs +++ b/crates/nu-command/src/math/mode.rs @@ -54,7 +54,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the most frequent element(s) from a list of numbers or tables." } diff --git a/crates/nu-command/src/math/product.rs b/crates/nu-command/src/math/product.rs index 2e457767bd..41e100b154 100644 --- a/crates/nu-command/src/math/product.rs +++ b/crates/nu-command/src/math/product.rs @@ -24,7 +24,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the product of a list of numbers or the products of each column of a table." } diff --git a/crates/nu-command/src/math/round.rs b/crates/nu-command/src/math/round.rs index 2faf7842d9..aeb92002c0 100644 --- a/crates/nu-command/src/math/round.rs +++ b/crates/nu-command/src/math/round.rs @@ -27,7 +27,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the input number rounded to the specified precision." } diff --git a/crates/nu-command/src/math/sqrt.rs b/crates/nu-command/src/math/sqrt.rs index d20978222c..b8f982a540 100644 --- a/crates/nu-command/src/math/sqrt.rs +++ b/crates/nu-command/src/math/sqrt.rs @@ -21,7 +21,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the square root of the input number." } diff --git a/crates/nu-command/src/math/stddev.rs b/crates/nu-command/src/math/stddev.rs index 2e221e3b1f..1e10cedf41 100644 --- a/crates/nu-command/src/math/stddev.rs +++ b/crates/nu-command/src/math/stddev.rs @@ -26,7 +26,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the standard deviation of a list of numbers, or of each column in a table." } diff --git a/crates/nu-command/src/math/sum.rs b/crates/nu-command/src/math/sum.rs index cd4b6b4540..30bc71bb7a 100644 --- a/crates/nu-command/src/math/sum.rs +++ b/crates/nu-command/src/math/sum.rs @@ -26,7 +26,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the sum of a list of numbers or of each column in a table." } diff --git a/crates/nu-command/src/math/variance.rs b/crates/nu-command/src/math/variance.rs index 7def47bb19..8422009230 100644 --- a/crates/nu-command/src/math/variance.rs +++ b/crates/nu-command/src/math/variance.rs @@ -25,7 +25,7 @@ impl Command for SubCommand { .category(Category::Math) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns the variance of a list of numbers or of each column in a table." } diff --git a/crates/nu-command/src/misc/panic.rs b/crates/nu-command/src/misc/panic.rs index cf1a5e053a..f8bb0bae66 100644 --- a/crates/nu-command/src/misc/panic.rs +++ b/crates/nu-command/src/misc/panic.rs @@ -8,7 +8,7 @@ impl Command for Panic { "panic" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Executes a rust panic, useful only for testing." } diff --git a/crates/nu-command/src/misc/source.rs b/crates/nu-command/src/misc/source.rs index 08a979b9f5..df002c998a 100644 --- a/crates/nu-command/src/misc/source.rs +++ b/crates/nu-command/src/misc/source.rs @@ -21,11 +21,11 @@ impl Command for Source { .category(Category::Core) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Runs a script file in the current context." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html"# } diff --git a/crates/nu-command/src/misc/tutor.rs b/crates/nu-command/src/misc/tutor.rs index 6b1c43534b..94c95763cb 100644 --- a/crates/nu-command/src/misc/tutor.rs +++ b/crates/nu-command/src/misc/tutor.rs @@ -27,7 +27,7 @@ impl Command for Tutor { .category(Category::Misc) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Run the tutorial. To begin, run: tutor." } diff --git a/crates/nu-command/src/network/http/delete.rs b/crates/nu-command/src/network/http/delete.rs index f32c9d15bb..27b43e2b76 100644 --- a/crates/nu-command/src/network/http/delete.rs +++ b/crates/nu-command/src/network/http/delete.rs @@ -82,11 +82,11 @@ impl Command for SubCommand { .category(Category::Network) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Delete the specified resource." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "Performs HTTP DELETE operation." } diff --git a/crates/nu-command/src/network/http/get.rs b/crates/nu-command/src/network/http/get.rs index 3b702404f4..f348cc9fd6 100644 --- a/crates/nu-command/src/network/http/get.rs +++ b/crates/nu-command/src/network/http/get.rs @@ -78,11 +78,11 @@ impl Command for SubCommand { .category(Category::Network) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Fetch the contents from a URL." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "Performs HTTP GET operation." } diff --git a/crates/nu-command/src/network/http/head.rs b/crates/nu-command/src/network/http/head.rs index 797fa138e3..37d6c46ba9 100644 --- a/crates/nu-command/src/network/http/head.rs +++ b/crates/nu-command/src/network/http/head.rs @@ -62,11 +62,11 @@ impl Command for SubCommand { .category(Category::Network) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Get the headers from a URL." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "Performs HTTP HEAD operation." } diff --git a/crates/nu-command/src/network/http/http_.rs b/crates/nu-command/src/network/http/http_.rs index 361033708e..a797054ced 100644 --- a/crates/nu-command/src/network/http/http_.rs +++ b/crates/nu-command/src/network/http/http_.rs @@ -14,11 +14,11 @@ impl Command for Http { .category(Category::Network) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Various commands for working with http methods." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu-command/src/network/http/options.rs b/crates/nu-command/src/network/http/options.rs index cd9a1f79c1..5c34be4041 100644 --- a/crates/nu-command/src/network/http/options.rs +++ b/crates/nu-command/src/network/http/options.rs @@ -61,11 +61,11 @@ impl Command for SubCommand { .category(Category::Network) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Requests permitted communication options for a given URL." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "Performs an HTTP OPTIONS request. Most commonly used for making CORS preflight requests." } diff --git a/crates/nu-command/src/network/http/patch.rs b/crates/nu-command/src/network/http/patch.rs index 7f49781284..09741c7492 100644 --- a/crates/nu-command/src/network/http/patch.rs +++ b/crates/nu-command/src/network/http/patch.rs @@ -78,11 +78,11 @@ impl Command for SubCommand { .category(Category::Network) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Patch a body to a URL." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "Performs HTTP PATCH operation." } diff --git a/crates/nu-command/src/network/http/post.rs b/crates/nu-command/src/network/http/post.rs index a593c5489c..f57953ea42 100644 --- a/crates/nu-command/src/network/http/post.rs +++ b/crates/nu-command/src/network/http/post.rs @@ -78,11 +78,11 @@ impl Command for SubCommand { .category(Category::Network) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Post a body to a URL." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "Performs HTTP POST operation." } diff --git a/crates/nu-command/src/network/http/put.rs b/crates/nu-command/src/network/http/put.rs index e2118ea359..ea7c722c4c 100644 --- a/crates/nu-command/src/network/http/put.rs +++ b/crates/nu-command/src/network/http/put.rs @@ -78,11 +78,11 @@ impl Command for SubCommand { .category(Category::Network) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Put a body to a URL." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "Performs HTTP PUT operation." } diff --git a/crates/nu-command/src/network/port.rs b/crates/nu-command/src/network/port.rs index 746df62d3a..eb77ab1d32 100644 --- a/crates/nu-command/src/network/port.rs +++ b/crates/nu-command/src/network/port.rs @@ -22,7 +22,7 @@ impl Command for SubCommand { .category(Category::Network) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Get a free port from system." } diff --git a/crates/nu-command/src/network/url/build_query.rs b/crates/nu-command/src/network/url/build_query.rs index dd50d9124f..1daabb507f 100644 --- a/crates/nu-command/src/network/url/build_query.rs +++ b/crates/nu-command/src/network/url/build_query.rs @@ -17,7 +17,7 @@ impl Command for SubCommand { .category(Category::Network) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Converts record or table into query string applying percent-encoding." } diff --git a/crates/nu-command/src/network/url/decode.rs b/crates/nu-command/src/network/url/decode.rs index b98e50a56e..8db5d09b15 100644 --- a/crates/nu-command/src/network/url/decode.rs +++ b/crates/nu-command/src/network/url/decode.rs @@ -31,7 +31,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Converts a percent-encoded web safe string to a string." } diff --git a/crates/nu-command/src/network/url/encode.rs b/crates/nu-command/src/network/url/encode.rs index 96e0289903..3854e0b401 100644 --- a/crates/nu-command/src/network/url/encode.rs +++ b/crates/nu-command/src/network/url/encode.rs @@ -32,7 +32,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Converts a string to a percent encoded web safe string." } diff --git a/crates/nu-command/src/network/url/join.rs b/crates/nu-command/src/network/url/join.rs index a2d6de8852..2bbd68bbcb 100644 --- a/crates/nu-command/src/network/url/join.rs +++ b/crates/nu-command/src/network/url/join.rs @@ -14,7 +14,7 @@ impl Command for SubCommand { .category(Category::Network) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Converts a record to url." } diff --git a/crates/nu-command/src/network/url/parse.rs b/crates/nu-command/src/network/url/parse.rs index 287c64c7b9..37502fd7ea 100644 --- a/crates/nu-command/src/network/url/parse.rs +++ b/crates/nu-command/src/network/url/parse.rs @@ -26,7 +26,7 @@ impl Command for SubCommand { .category(Category::Network) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Parses a url." } diff --git a/crates/nu-command/src/network/url/url_.rs b/crates/nu-command/src/network/url/url_.rs index 9988063d46..d139579a08 100644 --- a/crates/nu-command/src/network/url/url_.rs +++ b/crates/nu-command/src/network/url/url_.rs @@ -14,11 +14,11 @@ impl Command for Url { .category(Category::Network) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Various commands for working with URLs." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu-command/src/path/basename.rs b/crates/nu-command/src/path/basename.rs index 8b7082048e..d619a54c34 100644 --- a/crates/nu-command/src/path/basename.rs +++ b/crates/nu-command/src/path/basename.rs @@ -35,7 +35,7 @@ impl Command for SubCommand { .category(Category::Path) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Get the final component of a path." } diff --git a/crates/nu-command/src/path/dirname.rs b/crates/nu-command/src/path/dirname.rs index 218091ee34..3a3a1604e5 100644 --- a/crates/nu-command/src/path/dirname.rs +++ b/crates/nu-command/src/path/dirname.rs @@ -42,7 +42,7 @@ impl Command for SubCommand { .category(Category::Path) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Get the parent directory of a path." } diff --git a/crates/nu-command/src/path/exists.rs b/crates/nu-command/src/path/exists.rs index 86b00c6024..f00e6c17ef 100644 --- a/crates/nu-command/src/path/exists.rs +++ b/crates/nu-command/src/path/exists.rs @@ -33,11 +33,11 @@ impl Command for SubCommand { .category(Category::Path) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Check whether a path exists." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This only checks if it is possible to either `open` or `cd` to the given path. If you need to distinguish dirs and files, please use `path type`."# } diff --git a/crates/nu-command/src/path/expand.rs b/crates/nu-command/src/path/expand.rs index ac51978810..cea1282b9a 100644 --- a/crates/nu-command/src/path/expand.rs +++ b/crates/nu-command/src/path/expand.rs @@ -42,7 +42,7 @@ impl Command for SubCommand { .category(Category::Path) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Try to expand a path to its absolute form." } diff --git a/crates/nu-command/src/path/join.rs b/crates/nu-command/src/path/join.rs index 19d65b4c46..2d537f6822 100644 --- a/crates/nu-command/src/path/join.rs +++ b/crates/nu-command/src/path/join.rs @@ -33,11 +33,11 @@ impl Command for SubCommand { .category(Category::Path) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Join a structured path or a list of path parts." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"Optionally, append an additional path to the result. It is designed to accept the output of 'path parse' and 'path split' subcommands."# } diff --git a/crates/nu-command/src/path/parse.rs b/crates/nu-command/src/path/parse.rs index cec2f5c6ac..c41bfeff1a 100644 --- a/crates/nu-command/src/path/parse.rs +++ b/crates/nu-command/src/path/parse.rs @@ -32,11 +32,11 @@ impl Command for SubCommand { .category(Category::Path) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert a path into structured data." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"Each path is split into a table with 'parent', 'stem' and 'extension' fields. On Windows, an extra 'prefix' column is added."# } diff --git a/crates/nu-command/src/path/path_.rs b/crates/nu-command/src/path/path_.rs index 667008b658..bb2b46fb38 100644 --- a/crates/nu-command/src/path/path_.rs +++ b/crates/nu-command/src/path/path_.rs @@ -14,11 +14,11 @@ impl Command for PathCommand { .category(Category::Path) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Explore and manipulate paths." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"You must use one of the following subcommands. Using this command as-is will only produce this help message. There are three ways to represent a path: diff --git a/crates/nu-command/src/path/relative_to.rs b/crates/nu-command/src/path/relative_to.rs index 35df385d74..71cfa8b2a9 100644 --- a/crates/nu-command/src/path/relative_to.rs +++ b/crates/nu-command/src/path/relative_to.rs @@ -35,11 +35,11 @@ impl Command for SubCommand { .category(Category::Path) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Express a path as relative to another path." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"Can be used only when the input and the argument paths are either both absolute or both relative. The argument path needs to be a parent of the input path."# diff --git a/crates/nu-command/src/path/split.rs b/crates/nu-command/src/path/split.rs index 80d86fb998..727e99b024 100644 --- a/crates/nu-command/src/path/split.rs +++ b/crates/nu-command/src/path/split.rs @@ -27,7 +27,7 @@ impl Command for SubCommand { .category(Category::Path) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Split a path into a list based on the system's path separator." } diff --git a/crates/nu-command/src/path/type.rs b/crates/nu-command/src/path/type.rs index 010fd295ad..81cdaf8cfe 100644 --- a/crates/nu-command/src/path/type.rs +++ b/crates/nu-command/src/path/type.rs @@ -31,11 +31,11 @@ impl Command for SubCommand { .category(Category::Path) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Get the type of the object a path refers to (e.g., file, dir, symlink)." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"This checks the file system to confirm the path's object type. If the path does not exist, null will be returned."# } diff --git a/crates/nu-command/src/platform/ansi/ansi_.rs b/crates/nu-command/src/platform/ansi/ansi_.rs index 3daed5e157..43fd7d83df 100644 --- a/crates/nu-command/src/platform/ansi/ansi_.rs +++ b/crates/nu-command/src/platform/ansi/ansi_.rs @@ -528,11 +528,11 @@ impl Command for AnsiCommand { true } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Output ANSI codes to change color and style of text." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "An introduction to what ANSI escape sequences are can be found in the \u{1b}]8;;https://en.wikipedia.org/wiki/ANSI_escape_code\u{1b}\\ANSI escape code\u{1b}]8;;\u{1b}\\ Wikipedia page. diff --git a/crates/nu-command/src/platform/ansi/link.rs b/crates/nu-command/src/platform/ansi/link.rs index b45b365d3f..4e86f76236 100644 --- a/crates/nu-command/src/platform/ansi/link.rs +++ b/crates/nu-command/src/platform/ansi/link.rs @@ -35,7 +35,7 @@ impl Command for SubCommand { .category(Category::Platform) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Add a link (using OSC 8 escape sequence) to the given string." } diff --git a/crates/nu-command/src/platform/ansi/strip.rs b/crates/nu-command/src/platform/ansi/strip.rs index 4f7f8ea596..5f172c5cdc 100644 --- a/crates/nu-command/src/platform/ansi/strip.rs +++ b/crates/nu-command/src/platform/ansi/strip.rs @@ -40,7 +40,7 @@ impl Command for SubCommand { .category(Category::Platform) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Strip ANSI escape sequences from a string." } diff --git a/crates/nu-command/src/platform/clear.rs b/crates/nu-command/src/platform/clear.rs index 7dbe79bd22..30c6cc69a5 100644 --- a/crates/nu-command/src/platform/clear.rs +++ b/crates/nu-command/src/platform/clear.rs @@ -15,7 +15,7 @@ impl Command for Clear { "clear" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Clear the terminal." } diff --git a/crates/nu-command/src/platform/input/input_.rs b/crates/nu-command/src/platform/input/input_.rs index b7f074da0d..cf46b400c0 100644 --- a/crates/nu-command/src/platform/input/input_.rs +++ b/crates/nu-command/src/platform/input/input_.rs @@ -18,7 +18,7 @@ impl Command for Input { "input" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Get input from the user." } diff --git a/crates/nu-command/src/platform/input/input_listen.rs b/crates/nu-command/src/platform/input/input_listen.rs index 3ab44f2e60..406903f7d9 100644 --- a/crates/nu-command/src/platform/input/input_listen.rs +++ b/crates/nu-command/src/platform/input/input_listen.rs @@ -43,11 +43,11 @@ impl Command for InputListen { )]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Listen for user interface event." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"There are 5 different type of events: focus, key, mouse, paste, resize. Each will produce a corresponding record, distinguished by type field: ``` diff --git a/crates/nu-command/src/platform/input/list.rs b/crates/nu-command/src/platform/input/list.rs index 37f16e75d7..7d9761f296 100644 --- a/crates/nu-command/src/platform/input/list.rs +++ b/crates/nu-command/src/platform/input/list.rs @@ -54,11 +54,11 @@ impl Command for InputList { .category(Category::Platform) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Interactive list selection." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "Abort with esc or q." } diff --git a/crates/nu-command/src/platform/is_terminal.rs b/crates/nu-command/src/platform/is_terminal.rs index 2195f3ff8a..79cb27f188 100644 --- a/crates/nu-command/src/platform/is_terminal.rs +++ b/crates/nu-command/src/platform/is_terminal.rs @@ -18,7 +18,7 @@ impl Command for IsTerminal { .category(Category::Platform) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Check if stdin, stdout, or stderr is a terminal." } diff --git a/crates/nu-command/src/platform/kill.rs b/crates/nu-command/src/platform/kill.rs index 1cf6f15f01..06e0be859b 100644 --- a/crates/nu-command/src/platform/kill.rs +++ b/crates/nu-command/src/platform/kill.rs @@ -9,7 +9,7 @@ impl Command for Kill { "kill" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Kill a process using the process id." } diff --git a/crates/nu-command/src/platform/sleep.rs b/crates/nu-command/src/platform/sleep.rs index 4d5f6ec827..c63de6ae9d 100644 --- a/crates/nu-command/src/platform/sleep.rs +++ b/crates/nu-command/src/platform/sleep.rs @@ -15,7 +15,7 @@ impl Command for Sleep { "sleep" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Delay for a specified amount of time." } diff --git a/crates/nu-command/src/platform/term_size.rs b/crates/nu-command/src/platform/term_size.rs index 6fad20eb41..a4261dee81 100644 --- a/crates/nu-command/src/platform/term_size.rs +++ b/crates/nu-command/src/platform/term_size.rs @@ -9,7 +9,7 @@ impl Command for TermSize { "term size" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns a record containing the number of columns (width) and rows (height) of the terminal." } diff --git a/crates/nu-command/src/platform/ulimit.rs b/crates/nu-command/src/platform/ulimit.rs index 6ef2cd2b57..871633efc4 100644 --- a/crates/nu-command/src/platform/ulimit.rs +++ b/crates/nu-command/src/platform/ulimit.rs @@ -502,7 +502,7 @@ impl Command for ULimit { "ulimit" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Set or get resource usage limits." } diff --git a/crates/nu-command/src/platform/whoami.rs b/crates/nu-command/src/platform/whoami.rs index a1edc1e184..81253070b0 100644 --- a/crates/nu-command/src/platform/whoami.rs +++ b/crates/nu-command/src/platform/whoami.rs @@ -8,7 +8,7 @@ impl Command for Whoami { "whoami" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Get the current username using uutils/coreutils whoami." } diff --git a/crates/nu-command/src/random/binary.rs b/crates/nu-command/src/random/binary.rs index aacab071a8..136afc6e11 100644 --- a/crates/nu-command/src/random/binary.rs +++ b/crates/nu-command/src/random/binary.rs @@ -18,7 +18,7 @@ impl Command for SubCommand { .category(Category::Random) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Generate random bytes." } diff --git a/crates/nu-command/src/random/bool.rs b/crates/nu-command/src/random/bool.rs index 6c78516ed6..a2f13d337c 100644 --- a/crates/nu-command/src/random/bool.rs +++ b/crates/nu-command/src/random/bool.rs @@ -23,7 +23,7 @@ impl Command for SubCommand { .category(Category::Random) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Generate a random boolean value." } diff --git a/crates/nu-command/src/random/chars.rs b/crates/nu-command/src/random/chars.rs index aea27129b9..e2a1282f9e 100644 --- a/crates/nu-command/src/random/chars.rs +++ b/crates/nu-command/src/random/chars.rs @@ -28,7 +28,7 @@ impl Command for SubCommand { .category(Category::Random) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Generate random chars uniformly distributed over ASCII letters and numbers: a-z, A-Z and 0-9." } diff --git a/crates/nu-command/src/random/dice.rs b/crates/nu-command/src/random/dice.rs index 5e3a1b98b6..b11eb59e3e 100644 --- a/crates/nu-command/src/random/dice.rs +++ b/crates/nu-command/src/random/dice.rs @@ -29,7 +29,7 @@ impl Command for SubCommand { .category(Category::Random) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Generate a random dice roll." } diff --git a/crates/nu-command/src/random/float.rs b/crates/nu-command/src/random/float.rs index c34e468600..ad2c39e069 100644 --- a/crates/nu-command/src/random/float.rs +++ b/crates/nu-command/src/random/float.rs @@ -19,7 +19,7 @@ impl Command for SubCommand { .category(Category::Random) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Generate a random float within a range [min..max]." } diff --git a/crates/nu-command/src/random/int.rs b/crates/nu-command/src/random/int.rs index c04e957bf4..461ed2090c 100644 --- a/crates/nu-command/src/random/int.rs +++ b/crates/nu-command/src/random/int.rs @@ -23,7 +23,7 @@ impl Command for SubCommand { .category(Category::Random) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Generate a random integer [min..max]." } diff --git a/crates/nu-command/src/random/random_.rs b/crates/nu-command/src/random/random_.rs index 5cf14d7748..e9159e242a 100644 --- a/crates/nu-command/src/random/random_.rs +++ b/crates/nu-command/src/random/random_.rs @@ -14,11 +14,11 @@ impl Command for RandomCommand { .input_output_types(vec![(Type::Nothing, Type::String)]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Generate a random value." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu-command/src/random/uuid.rs b/crates/nu-command/src/random/uuid.rs index c8d8d638b9..97f57f1ae8 100644 --- a/crates/nu-command/src/random/uuid.rs +++ b/crates/nu-command/src/random/uuid.rs @@ -16,7 +16,7 @@ impl Command for SubCommand { .allow_variants_without_examples(true) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Generate a random uuid4 string." } diff --git a/crates/nu-command/src/removed/format.rs b/crates/nu-command/src/removed/format.rs index fb2b50cd39..84083b037b 100644 --- a/crates/nu-command/src/removed/format.rs +++ b/crates/nu-command/src/removed/format.rs @@ -24,7 +24,7 @@ impl Command for SubCommand { .category(Category::Removed) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Removed command: use `format date` instead." } diff --git a/crates/nu-command/src/removed/let_env.rs b/crates/nu-command/src/removed/let_env.rs index a7e3de594c..07c73f06b6 100644 --- a/crates/nu-command/src/removed/let_env.rs +++ b/crates/nu-command/src/removed/let_env.rs @@ -21,7 +21,7 @@ impl Command for LetEnv { .category(Category::Removed) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "`let-env FOO = ...` has been removed, use `$env.FOO = ...` instead." } diff --git a/crates/nu-command/src/shells/exit.rs b/crates/nu-command/src/shells/exit.rs index 018c519ef7..68494e52ef 100644 --- a/crates/nu-command/src/shells/exit.rs +++ b/crates/nu-command/src/shells/exit.rs @@ -19,7 +19,7 @@ impl Command for Exit { .category(Category::Shells) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Exit Nu." } diff --git a/crates/nu-command/src/stor/create.rs b/crates/nu-command/src/stor/create.rs index 1e1219889d..37cc57ce6c 100644 --- a/crates/nu-command/src/stor/create.rs +++ b/crates/nu-command/src/stor/create.rs @@ -28,7 +28,7 @@ impl Command for StorCreate { .category(Category::Database) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Create a table in the in-memory sqlite database." } diff --git a/crates/nu-command/src/stor/delete.rs b/crates/nu-command/src/stor/delete.rs index 676e0490b0..5605794f11 100644 --- a/crates/nu-command/src/stor/delete.rs +++ b/crates/nu-command/src/stor/delete.rs @@ -29,7 +29,7 @@ impl Command for StorDelete { .category(Category::Database) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Delete a table or specified rows in the in-memory sqlite database." } diff --git a/crates/nu-command/src/stor/export.rs b/crates/nu-command/src/stor/export.rs index f8255eec49..ab7081c318 100644 --- a/crates/nu-command/src/stor/export.rs +++ b/crates/nu-command/src/stor/export.rs @@ -23,7 +23,7 @@ impl Command for StorExport { .category(Category::Database) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Export the in-memory sqlite database to a sqlite database file." } diff --git a/crates/nu-command/src/stor/import.rs b/crates/nu-command/src/stor/import.rs index 20b5b64f2d..8f5e99afd6 100644 --- a/crates/nu-command/src/stor/import.rs +++ b/crates/nu-command/src/stor/import.rs @@ -23,7 +23,7 @@ impl Command for StorImport { .category(Category::Database) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Import a sqlite database file into the in-memory sqlite database." } diff --git a/crates/nu-command/src/stor/insert.rs b/crates/nu-command/src/stor/insert.rs index 0e5c9ec6af..106e4fbffb 100644 --- a/crates/nu-command/src/stor/insert.rs +++ b/crates/nu-command/src/stor/insert.rs @@ -33,7 +33,7 @@ impl Command for StorInsert { .category(Category::Database) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Insert information into a specified table in the in-memory sqlite database." } diff --git a/crates/nu-command/src/stor/open.rs b/crates/nu-command/src/stor/open.rs index ba0f17c2af..b200d8e86e 100644 --- a/crates/nu-command/src/stor/open.rs +++ b/crates/nu-command/src/stor/open.rs @@ -20,7 +20,7 @@ impl Command for StorOpen { .category(Category::Database) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Opens the in-memory sqlite database." } diff --git a/crates/nu-command/src/stor/reset.rs b/crates/nu-command/src/stor/reset.rs index ba9e2a9681..dc68a83188 100644 --- a/crates/nu-command/src/stor/reset.rs +++ b/crates/nu-command/src/stor/reset.rs @@ -17,7 +17,7 @@ impl Command for StorReset { .category(Category::Database) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Reset the in-memory database by dropping all tables." } diff --git a/crates/nu-command/src/stor/stor_.rs b/crates/nu-command/src/stor/stor_.rs index c5bb378c2d..d8224e05ca 100644 --- a/crates/nu-command/src/stor/stor_.rs +++ b/crates/nu-command/src/stor/stor_.rs @@ -14,11 +14,11 @@ impl Command for Stor { .input_output_types(vec![(Type::Nothing, Type::String)]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Various commands for working with the in-memory sqlite database." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu-command/src/stor/update.rs b/crates/nu-command/src/stor/update.rs index 18cf6f9f0f..a158e0f7d0 100644 --- a/crates/nu-command/src/stor/update.rs +++ b/crates/nu-command/src/stor/update.rs @@ -38,7 +38,7 @@ impl Command for StorUpdate { .category(Category::Database) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Update information in a specified table in the in-memory sqlite database." } diff --git a/crates/nu-command/src/strings/char_.rs b/crates/nu-command/src/strings/char_.rs index aa987438d2..889efa2c27 100644 --- a/crates/nu-command/src/strings/char_.rs +++ b/crates/nu-command/src/strings/char_.rs @@ -193,7 +193,7 @@ impl Command for Char { true } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Output special characters (e.g., 'newline')." } diff --git a/crates/nu-command/src/strings/detect_columns.rs b/crates/nu-command/src/strings/detect_columns.rs index 37a7cfe303..23858d9e49 100644 --- a/crates/nu-command/src/strings/detect_columns.rs +++ b/crates/nu-command/src/strings/detect_columns.rs @@ -37,7 +37,7 @@ impl Command for DetectColumns { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Attempt to automatically split text into multiple columns." } diff --git a/crates/nu-command/src/strings/encode_decode/decode.rs b/crates/nu-command/src/strings/encode_decode/decode.rs index 20385612f3..99bc1b9681 100644 --- a/crates/nu-command/src/strings/encode_decode/decode.rs +++ b/crates/nu-command/src/strings/encode_decode/decode.rs @@ -8,7 +8,7 @@ impl Command for Decode { "decode" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Decode bytes into a string." } @@ -23,7 +23,7 @@ impl Command for Decode { .category(Category::Strings) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"Multiple encodings are supported; here are a few: big5, euc-jp, euc-kr, gbk, iso-8859-1, utf-16, cp1252, latin5 diff --git a/crates/nu-command/src/strings/encode_decode/decode_base64.rs b/crates/nu-command/src/strings/encode_decode/decode_base64.rs index cda9de4be8..083c1c8448 100644 --- a/crates/nu-command/src/strings/encode_decode/decode_base64.rs +++ b/crates/nu-command/src/strings/encode_decode/decode_base64.rs @@ -40,11 +40,11 @@ impl Command for DecodeBase64 { .category(Category::Hash) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Base64 decode a value." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"Will attempt to decode binary payload as an UTF-8 string by default. Use the `--binary(-b)` argument to force binary output."# } diff --git a/crates/nu-command/src/strings/encode_decode/encode.rs b/crates/nu-command/src/strings/encode_decode/encode.rs index b7bebdba80..ed0f7714bb 100644 --- a/crates/nu-command/src/strings/encode_decode/encode.rs +++ b/crates/nu-command/src/strings/encode_decode/encode.rs @@ -8,7 +8,7 @@ impl Command for Encode { "encode" } - fn usage(&self) -> &str { + fn description(&self) -> &str { // Note: "Encode a UTF-8 string into other forms" is semantically incorrect because // Nushell strings, as abstract values, have no user-facing encoding. // (Remember that "encoding" exclusively means "how the characters are @@ -32,7 +32,7 @@ impl Command for Encode { .category(Category::Strings) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"Multiple encodings are supported; here are a few: big5, euc-jp, euc-kr, gbk, iso-8859-1, cp1252, latin5 diff --git a/crates/nu-command/src/strings/encode_decode/encode_base64.rs b/crates/nu-command/src/strings/encode_decode/encode_base64.rs index b01530b107..08a9cb5e51 100644 --- a/crates/nu-command/src/strings/encode_decode/encode_base64.rs +++ b/crates/nu-command/src/strings/encode_decode/encode_base64.rs @@ -46,7 +46,7 @@ impl Command for EncodeBase64 { .category(Category::Hash) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Encode a string or binary value using Base64." } diff --git a/crates/nu-command/src/strings/format/date.rs b/crates/nu-command/src/strings/format/date.rs index dd005b9216..fd398753d7 100644 --- a/crates/nu-command/src/strings/format/date.rs +++ b/crates/nu-command/src/strings/format/date.rs @@ -30,7 +30,7 @@ impl Command for FormatDate { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Format a given date using a format string." } diff --git a/crates/nu-command/src/strings/format/duration.rs b/crates/nu-command/src/strings/format/duration.rs index fbbe192048..c713f64a6f 100644 --- a/crates/nu-command/src/strings/format/duration.rs +++ b/crates/nu-command/src/strings/format/duration.rs @@ -45,7 +45,7 @@ impl Command for FormatDuration { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Outputs duration with a specified unit of time." } diff --git a/crates/nu-command/src/strings/format/filesize.rs b/crates/nu-command/src/strings/format/filesize.rs index 63865ac2ac..d6f898fee8 100644 --- a/crates/nu-command/src/strings/format/filesize.rs +++ b/crates/nu-command/src/strings/format/filesize.rs @@ -42,7 +42,7 @@ impl Command for FormatFilesize { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Converts a column of filesizes to some specified format." } diff --git a/crates/nu-command/src/strings/format/format_.rs b/crates/nu-command/src/strings/format/format_.rs index 21b46a8b05..72554f18e7 100644 --- a/crates/nu-command/src/strings/format/format_.rs +++ b/crates/nu-command/src/strings/format/format_.rs @@ -14,11 +14,11 @@ impl Command for Format { .input_output_types(vec![(Type::Nothing, Type::String)]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Various commands for formatting data." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu-command/src/strings/parse.rs b/crates/nu-command/src/strings/parse.rs index 86b27aecbc..b7e546007a 100644 --- a/crates/nu-command/src/strings/parse.rs +++ b/crates/nu-command/src/strings/parse.rs @@ -11,7 +11,7 @@ impl Command for Parse { "parse" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Parse columns from string data using a simple pattern or a supplied regular expression." } @@ -19,7 +19,7 @@ impl Command for Parse { vec!["pattern", "match", "regex", "str extract"] } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "The parse command always uses regular expressions even when you use a simple pattern. If a simple pattern is supplied, parse will transform that pattern into a regular expression." } diff --git a/crates/nu-command/src/strings/split/chars.rs b/crates/nu-command/src/strings/split/chars.rs index 370df262ea..ac71121645 100644 --- a/crates/nu-command/src/strings/split/chars.rs +++ b/crates/nu-command/src/strings/split/chars.rs @@ -30,7 +30,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Split a string into a list of characters." } diff --git a/crates/nu-command/src/strings/split/column.rs b/crates/nu-command/src/strings/split/column.rs index 540cfabe54..4a9a96a8d7 100644 --- a/crates/nu-command/src/strings/split/column.rs +++ b/crates/nu-command/src/strings/split/column.rs @@ -35,7 +35,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Split a string into multiple columns using a separator." } diff --git a/crates/nu-command/src/strings/split/command.rs b/crates/nu-command/src/strings/split/command.rs index ff9057eacc..8f76f30a18 100644 --- a/crates/nu-command/src/strings/split/command.rs +++ b/crates/nu-command/src/strings/split/command.rs @@ -14,11 +14,11 @@ impl Command for SplitCommand { .input_output_types(vec![(Type::Nothing, Type::String)]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Split contents across desired subcommand (like row, column) via the separator." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu-command/src/strings/split/list.rs b/crates/nu-command/src/strings/split/list.rs index eb874841a2..82f7ec730a 100644 --- a/crates/nu-command/src/strings/split/list.rs +++ b/crates/nu-command/src/strings/split/list.rs @@ -28,7 +28,7 @@ impl Command for SubCommand { .category(Category::Filters) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Split a list into multiple lists using a separator." } diff --git a/crates/nu-command/src/strings/split/row.rs b/crates/nu-command/src/strings/split/row.rs index 1f427a06e0..73da7e6de8 100644 --- a/crates/nu-command/src/strings/split/row.rs +++ b/crates/nu-command/src/strings/split/row.rs @@ -35,7 +35,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Split a string into multiple rows using a separator." } diff --git a/crates/nu-command/src/strings/split/words.rs b/crates/nu-command/src/strings/split/words.rs index b95a06f65c..9d392302c2 100644 --- a/crates/nu-command/src/strings/split/words.rs +++ b/crates/nu-command/src/strings/split/words.rs @@ -56,7 +56,7 @@ impl Command for SubCommand { ) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Split a string's words into separate rows." } diff --git a/crates/nu-command/src/strings/str_/case/capitalize.rs b/crates/nu-command/src/strings/str_/case/capitalize.rs index 862ca127c2..545385a13c 100644 --- a/crates/nu-command/src/strings/str_/case/capitalize.rs +++ b/crates/nu-command/src/strings/str_/case/capitalize.rs @@ -28,7 +28,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Capitalize first letter of text." } diff --git a/crates/nu-command/src/strings/str_/case/downcase.rs b/crates/nu-command/src/strings/str_/case/downcase.rs index 0493a663aa..72c6619fc3 100644 --- a/crates/nu-command/src/strings/str_/case/downcase.rs +++ b/crates/nu-command/src/strings/str_/case/downcase.rs @@ -28,7 +28,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Make text lowercase." } diff --git a/crates/nu-command/src/strings/str_/case/str_.rs b/crates/nu-command/src/strings/str_/case/str_.rs index fe6cb86324..4ee04ec1e4 100644 --- a/crates/nu-command/src/strings/str_/case/str_.rs +++ b/crates/nu-command/src/strings/str_/case/str_.rs @@ -14,11 +14,11 @@ impl Command for Str { .input_output_types(vec![(Type::Nothing, Type::String)]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Various commands for working with string data." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu-command/src/strings/str_/case/upcase.rs b/crates/nu-command/src/strings/str_/case/upcase.rs index 557239ec91..0fe46ce4e7 100644 --- a/crates/nu-command/src/strings/str_/case/upcase.rs +++ b/crates/nu-command/src/strings/str_/case/upcase.rs @@ -28,7 +28,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Make text uppercase." } diff --git a/crates/nu-command/src/strings/str_/contains.rs b/crates/nu-command/src/strings/str_/contains.rs index 27d8a8e313..e64ed8c72b 100644 --- a/crates/nu-command/src/strings/str_/contains.rs +++ b/crates/nu-command/src/strings/str_/contains.rs @@ -42,7 +42,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Checks if string input contains a substring." } diff --git a/crates/nu-command/src/strings/str_/deunicode.rs b/crates/nu-command/src/strings/str_/deunicode.rs index ef732571f9..48423c2be1 100644 --- a/crates/nu-command/src/strings/str_/deunicode.rs +++ b/crates/nu-command/src/strings/str_/deunicode.rs @@ -17,7 +17,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert Unicode string to pure ASCII." } diff --git a/crates/nu-command/src/strings/str_/distance.rs b/crates/nu-command/src/strings/str_/distance.rs index 9b88f8e3e0..ce54abcbe4 100644 --- a/crates/nu-command/src/strings/str_/distance.rs +++ b/crates/nu-command/src/strings/str_/distance.rs @@ -41,7 +41,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Compare two strings and return the edit distance/Levenshtein distance." } diff --git a/crates/nu-command/src/strings/str_/ends_with.rs b/crates/nu-command/src/strings/str_/ends_with.rs index d4841b74e0..bb70a919e8 100644 --- a/crates/nu-command/src/strings/str_/ends_with.rs +++ b/crates/nu-command/src/strings/str_/ends_with.rs @@ -42,7 +42,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Check if an input ends with a string." } diff --git a/crates/nu-command/src/strings/str_/expand.rs b/crates/nu-command/src/strings/str_/expand.rs index b9759ef6a1..985c7fa57d 100644 --- a/crates/nu-command/src/strings/str_/expand.rs +++ b/crates/nu-command/src/strings/str_/expand.rs @@ -8,11 +8,11 @@ impl Command for SubCommand { "str expand" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Generates all possible combinations defined in brace expansion syntax." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "This syntax may seem familiar with `glob {A,B}.C`. The difference is glob relies on filesystem, but str expand is not. Inside braces, we put variants. Then basically we're creating all possible outcomes." } diff --git a/crates/nu-command/src/strings/str_/index_of.rs b/crates/nu-command/src/strings/str_/index_of.rs index a6b06ef9b7..eace6c0494 100644 --- a/crates/nu-command/src/strings/str_/index_of.rs +++ b/crates/nu-command/src/strings/str_/index_of.rs @@ -64,7 +64,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns start index of first occurrence of string in input, or -1 if no match." } diff --git a/crates/nu-command/src/strings/str_/join.rs b/crates/nu-command/src/strings/str_/join.rs index d297ea4cbc..e40ffb9417 100644 --- a/crates/nu-command/src/strings/str_/join.rs +++ b/crates/nu-command/src/strings/str_/join.rs @@ -26,7 +26,7 @@ impl Command for StrJoin { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Concatenate multiple strings into a single string, with an optional separator between each." } diff --git a/crates/nu-command/src/strings/str_/length.rs b/crates/nu-command/src/strings/str_/length.rs index ab0ba8db49..ca1313e710 100644 --- a/crates/nu-command/src/strings/str_/length.rs +++ b/crates/nu-command/src/strings/str_/length.rs @@ -50,7 +50,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Output the length of any strings in the pipeline." } diff --git a/crates/nu-command/src/strings/str_/replace.rs b/crates/nu-command/src/strings/str_/replace.rs index 342dd0693e..c15d0003aa 100644 --- a/crates/nu-command/src/strings/str_/replace.rs +++ b/crates/nu-command/src/strings/str_/replace.rs @@ -65,7 +65,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Find and replace text." } diff --git a/crates/nu-command/src/strings/str_/reverse.rs b/crates/nu-command/src/strings/str_/reverse.rs index 9a339f7bcc..310efed854 100644 --- a/crates/nu-command/src/strings/str_/reverse.rs +++ b/crates/nu-command/src/strings/str_/reverse.rs @@ -29,7 +29,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Reverse every string in the pipeline." } diff --git a/crates/nu-command/src/strings/str_/starts_with.rs b/crates/nu-command/src/strings/str_/starts_with.rs index bac451466c..fecf560519 100644 --- a/crates/nu-command/src/strings/str_/starts_with.rs +++ b/crates/nu-command/src/strings/str_/starts_with.rs @@ -43,7 +43,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Check if an input starts with a string." } diff --git a/crates/nu-command/src/strings/str_/stats.rs b/crates/nu-command/src/strings/str_/stats.rs index eb091ae4f6..48d9f95daf 100644 --- a/crates/nu-command/src/strings/str_/stats.rs +++ b/crates/nu-command/src/strings/str_/stats.rs @@ -22,7 +22,7 @@ impl Command for SubCommand { .input_output_types(vec![(Type::String, Type::record())]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Gather word count statistics on the text." } diff --git a/crates/nu-command/src/strings/str_/substring.rs b/crates/nu-command/src/strings/str_/substring.rs index 10464580c7..58f32391fa 100644 --- a/crates/nu-command/src/strings/str_/substring.rs +++ b/crates/nu-command/src/strings/str_/substring.rs @@ -68,7 +68,7 @@ impl Command for SubCommand { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Get part of a string. Note that the first character of a string is index 0." } diff --git a/crates/nu-command/src/strings/str_/trim/trim_.rs b/crates/nu-command/src/strings/str_/trim/trim_.rs index 76d886a010..71e4359f78 100644 --- a/crates/nu-command/src/strings/str_/trim/trim_.rs +++ b/crates/nu-command/src/strings/str_/trim/trim_.rs @@ -63,7 +63,7 @@ impl Command for SubCommand { ) .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Trim whitespace or specific character." } diff --git a/crates/nu-command/src/system/complete.rs b/crates/nu-command/src/system/complete.rs index 409cef1f27..948f8acec6 100644 --- a/crates/nu-command/src/system/complete.rs +++ b/crates/nu-command/src/system/complete.rs @@ -15,11 +15,11 @@ impl Command for Complete { .input_output_types(vec![(Type::Any, Type::record())]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Capture the outputs and exit code from an external piped in command in a nushell table." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"In order to capture stdout, stderr, and exit_code, externally piped in commands need to be wrapped with `do`"# } diff --git a/crates/nu-command/src/system/exec.rs b/crates/nu-command/src/system/exec.rs index 018017cfb2..7bf9daecc9 100644 --- a/crates/nu-command/src/system/exec.rs +++ b/crates/nu-command/src/system/exec.rs @@ -16,11 +16,11 @@ impl Command for Exec { .category(Category::System) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Execute a command, replacing or exiting the current process, depending on platform." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"On Unix-based systems, the current process is replaced with the command. On Windows based systems, Nushell will wait for the command to finish and then exit with the command's exit code."# } diff --git a/crates/nu-command/src/system/nu_check.rs b/crates/nu-command/src/system/nu_check.rs index c0c29858d5..59982dfaa7 100644 --- a/crates/nu-command/src/system/nu_check.rs +++ b/crates/nu-command/src/system/nu_check.rs @@ -25,7 +25,7 @@ impl Command for NuCheck { .category(Category::Strings) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Validate and parse input content." } diff --git a/crates/nu-command/src/system/ps.rs b/crates/nu-command/src/system/ps.rs index 02bcabe130..6f39061dab 100644 --- a/crates/nu-command/src/system/ps.rs +++ b/crates/nu-command/src/system/ps.rs @@ -26,7 +26,7 @@ impl Command for Ps { .category(Category::System) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "View information about system processes." } diff --git a/crates/nu-command/src/system/registry_query.rs b/crates/nu-command/src/system/registry_query.rs index 9b68059ffa..3365a7d440 100644 --- a/crates/nu-command/src/system/registry_query.rs +++ b/crates/nu-command/src/system/registry_query.rs @@ -42,11 +42,11 @@ impl Command for RegistryQuery { .category(Category::System) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Query the Windows registry." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "Currently supported only on Windows systems." } diff --git a/crates/nu-command/src/system/run_external.rs b/crates/nu-command/src/system/run_external.rs index c812280b62..743956250a 100644 --- a/crates/nu-command/src/system/run_external.rs +++ b/crates/nu-command/src/system/run_external.rs @@ -23,7 +23,7 @@ impl Command for External { "run-external" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Runs external command." } diff --git a/crates/nu-command/src/system/sys/cpu.rs b/crates/nu-command/src/system/sys/cpu.rs index d24197bf70..3243478e03 100644 --- a/crates/nu-command/src/system/sys/cpu.rs +++ b/crates/nu-command/src/system/sys/cpu.rs @@ -17,7 +17,7 @@ impl Command for SysCpu { .input_output_types(vec![(Type::Nothing, Type::table())]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "View information about the system CPUs." } diff --git a/crates/nu-command/src/system/sys/disks.rs b/crates/nu-command/src/system/sys/disks.rs index 0d9ce09db3..5b87acb51c 100644 --- a/crates/nu-command/src/system/sys/disks.rs +++ b/crates/nu-command/src/system/sys/disks.rs @@ -17,7 +17,7 @@ impl Command for SysDisks { .input_output_types(vec![(Type::Nothing, Type::table())]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "View information about the system disks." } diff --git a/crates/nu-command/src/system/sys/host.rs b/crates/nu-command/src/system/sys/host.rs index 64dd43424d..d74258872f 100644 --- a/crates/nu-command/src/system/sys/host.rs +++ b/crates/nu-command/src/system/sys/host.rs @@ -18,7 +18,7 @@ impl Command for SysHost { .input_output_types(vec![(Type::Nothing, Type::record())]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "View information about the system host." } diff --git a/crates/nu-command/src/system/sys/mem.rs b/crates/nu-command/src/system/sys/mem.rs index 89527807d7..58ad452755 100644 --- a/crates/nu-command/src/system/sys/mem.rs +++ b/crates/nu-command/src/system/sys/mem.rs @@ -16,7 +16,7 @@ impl Command for SysMem { .input_output_types(vec![(Type::Nothing, Type::record())]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "View information about the system memory." } diff --git a/crates/nu-command/src/system/sys/net.rs b/crates/nu-command/src/system/sys/net.rs index ef1c595800..ee82f73c61 100644 --- a/crates/nu-command/src/system/sys/net.rs +++ b/crates/nu-command/src/system/sys/net.rs @@ -17,7 +17,7 @@ impl Command for SysNet { .input_output_types(vec![(Type::Nothing, Type::table())]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "View information about the system network interfaces." } diff --git a/crates/nu-command/src/system/sys/sys_.rs b/crates/nu-command/src/system/sys/sys_.rs index 5369064f50..116df62dcb 100644 --- a/crates/nu-command/src/system/sys/sys_.rs +++ b/crates/nu-command/src/system/sys/sys_.rs @@ -15,11 +15,11 @@ impl Command for Sys { .input_output_types(vec![(Type::Nothing, Type::record())]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "View information about the system." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu-command/src/system/sys/temp.rs b/crates/nu-command/src/system/sys/temp.rs index 088471f0fd..e743779e84 100644 --- a/crates/nu-command/src/system/sys/temp.rs +++ b/crates/nu-command/src/system/sys/temp.rs @@ -16,11 +16,11 @@ impl Command for SysTemp { .input_output_types(vec![(Type::Nothing, Type::table())]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "View the temperatures of system components." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "Some system components do not support temperature readings, so this command may return an empty list if no components support temperature." } diff --git a/crates/nu-command/src/system/sys/users.rs b/crates/nu-command/src/system/sys/users.rs index 04d9b9db91..ffc84f05bb 100644 --- a/crates/nu-command/src/system/sys/users.rs +++ b/crates/nu-command/src/system/sys/users.rs @@ -16,7 +16,7 @@ impl Command for SysUsers { .input_output_types(vec![(Type::Nothing, Type::table())]) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "View information about the users on the system." } diff --git a/crates/nu-command/src/system/uname.rs b/crates/nu-command/src/system/uname.rs index 0bcb749f02..47a40b2ec8 100644 --- a/crates/nu-command/src/system/uname.rs +++ b/crates/nu-command/src/system/uname.rs @@ -15,7 +15,7 @@ impl Command for UName { .category(Category::System) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Print certain system information using uutils/coreutils uname." } diff --git a/crates/nu-command/src/system/which_.rs b/crates/nu-command/src/system/which_.rs index fd5b0beb18..a386590605 100644 --- a/crates/nu-command/src/system/which_.rs +++ b/crates/nu-command/src/system/which_.rs @@ -20,7 +20,7 @@ impl Command for Which { .category(Category::System) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Finds a program file, alias or custom command." } diff --git a/crates/nu-command/src/viewers/griddle.rs b/crates/nu-command/src/viewers/griddle.rs index c3e003be39..4c26514c1b 100644 --- a/crates/nu-command/src/viewers/griddle.rs +++ b/crates/nu-command/src/viewers/griddle.rs @@ -16,7 +16,7 @@ impl Command for Griddle { "grid" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Renders the output to a textual terminal grid." } @@ -42,7 +42,7 @@ impl Command for Griddle { .category(Category::Viewers) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"grid was built to give a concise gridded layout for ls. however, it determines what to put in the grid by looking for a column named 'name'. this works great for tables and records but for lists we diff --git a/crates/nu-command/src/viewers/table.rs b/crates/nu-command/src/viewers/table.rs index e5fdf681f7..7ad15497da 100644 --- a/crates/nu-command/src/viewers/table.rs +++ b/crates/nu-command/src/viewers/table.rs @@ -45,11 +45,11 @@ impl Command for Table { "table" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Render the table." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "If the table contains a column called 'index', this column is used as the table index instead of the usual continuous index." } diff --git a/crates/nu-command/tests/commands/help.rs b/crates/nu-command/tests/commands/help.rs index 26e4a92b26..10b3bf6999 100644 --- a/crates/nu-command/tests/commands/help.rs +++ b/crates/nu-command/tests/commands/help.rs @@ -36,8 +36,8 @@ fn help_aliases() { } #[test] -fn help_alias_usage_1() { - Playground::setup("help_alias_usage_1", |dirs, sandbox| { +fn help_alias_description_1() { + Playground::setup("help_alias_description_1", |dirs, sandbox| { sandbox.with_files(&[FileWithContent( "spam.nu", r#" @@ -48,7 +48,7 @@ fn help_alias_usage_1() { let code = &[ "source spam.nu", - "help aliases | where name == SPAM | get 0.usage", + "help aliases | where name == SPAM | get 0.description", ]; let actual = nu!(cwd: dirs.test(), nu_repl_code(code)); @@ -57,10 +57,10 @@ fn help_alias_usage_1() { } #[test] -fn help_alias_usage_2() { +fn help_alias_description_2() { let code = &[ "alias SPAM = print 'spam' # line2", - "help aliases | where name == SPAM | get 0.usage", + "help aliases | where name == SPAM | get 0.description", ]; let actual = nu!(nu_repl_code(code)); @@ -68,8 +68,8 @@ fn help_alias_usage_2() { } #[test] -fn help_alias_usage_3() { - Playground::setup("help_alias_usage_3", |dirs, sandbox| { +fn help_alias_description_3() { + Playground::setup("help_alias_description_3", |dirs, sandbox| { sandbox.with_files(&[FileWithContent( "spam.nu", r#" @@ -80,7 +80,7 @@ fn help_alias_usage_3() { let code = &[ "source spam.nu", - "help aliases | where name == SPAM | get 0.usage", + "help aliases | where name == SPAM | get 0.description", ]; let actual = nu!(cwd: dirs.test(), nu_repl_code(code)); @@ -121,7 +121,7 @@ fn help_alias_name_f() { "#, )]); - let code = &["source spam.nu", "help aliases -f SPAM | get 0.usage"]; + let code = &["source spam.nu", "help aliases -f SPAM | get 0.description"]; let actual = nu!(cwd: dirs.test(), nu_repl_code(code)); assert!(actual.out.contains("line1")); @@ -172,8 +172,8 @@ fn help_export_alias_name_multi_word() { } #[test] -fn help_module_usage_1() { - Playground::setup("help_module_usage", |dirs, sandbox| { +fn help_module_description_1() { + Playground::setup("help_module_description", |dirs, sandbox| { sandbox.with_files(&[FileWithContent( "spam.nu", r#" @@ -186,7 +186,7 @@ fn help_module_usage_1() { let code = &[ "source spam.nu", - "help modules | where name == SPAM | get 0.usage", + "help modules | where name == SPAM | get 0.description", ]; let actual = nu!(cwd: dirs.test(), nu_repl_code(code)); @@ -260,11 +260,13 @@ fn help_module_sorted_aliases() { } #[test] -fn help_usage_extra_usage_command() { - Playground::setup("help_usage_extra_usage_command", |dirs, sandbox| { - sandbox.with_files(&[FileWithContent( - "spam.nu", - r#" +fn help_description_extra_description_command() { + Playground::setup( + "help_description_extra_description_command", + |dirs, sandbox| { + sandbox.with_files(&[FileWithContent( + "spam.nu", + r#" # module_line1 # # module_line2 @@ -274,34 +276,37 @@ fn help_usage_extra_usage_command() { # def_line2 export def foo [] {} "#, - )]); + )]); - let actual = nu!(cwd: dirs.test(), "use spam.nu *; help modules spam"); - assert!(actual.out.contains("module_line1")); - assert!(actual.out.contains("module_line2")); + let actual = nu!(cwd: dirs.test(), "use spam.nu *; help modules spam"); + assert!(actual.out.contains("module_line1")); + assert!(actual.out.contains("module_line2")); - let actual = nu!(cwd: dirs.test(), - "use spam.nu *; help modules | where name == spam | get 0.usage"); - assert!(actual.out.contains("module_line1")); - assert!(!actual.out.contains("module_line2")); + let actual = nu!(cwd: dirs.test(), + "use spam.nu *; help modules | where name == spam | get 0.description"); + assert!(actual.out.contains("module_line1")); + assert!(!actual.out.contains("module_line2")); - let actual = nu!(cwd: dirs.test(), "use spam.nu *; help commands foo"); - assert!(actual.out.contains("def_line1")); - assert!(actual.out.contains("def_line2")); + let actual = nu!(cwd: dirs.test(), "use spam.nu *; help commands foo"); + assert!(actual.out.contains("def_line1")); + assert!(actual.out.contains("def_line2")); - let actual = nu!(cwd: dirs.test(), - "use spam.nu *; help commands | where name == foo | get 0.usage"); - assert!(actual.out.contains("def_line1")); - assert!(!actual.out.contains("def_line2")); - }) + let actual = nu!(cwd: dirs.test(), + "use spam.nu *; help commands | where name == foo | get 0.description"); + assert!(actual.out.contains("def_line1")); + assert!(!actual.out.contains("def_line2")); + }, + ) } #[test] -fn help_usage_extra_usage_alias() { - Playground::setup("help_usage_extra_usage_alias", |dirs, sandbox| { - sandbox.with_files(&[FileWithContent( - "spam.nu", - r#" +fn help_description_extra_description_alias() { + Playground::setup( + "help_description_extra_description_alias", + |dirs, sandbox| { + sandbox.with_files(&[FileWithContent( + "spam.nu", + r#" # module_line1 # # module_line2 @@ -311,26 +316,27 @@ fn help_usage_extra_usage_alias() { # alias_line2 export alias bar = echo 'bar' "#, - )]); + )]); - let actual = nu!(cwd: dirs.test(), "use spam.nu *; help modules spam"); - assert!(actual.out.contains("module_line1")); - assert!(actual.out.contains("module_line2")); + let actual = nu!(cwd: dirs.test(), "use spam.nu *; help modules spam"); + assert!(actual.out.contains("module_line1")); + assert!(actual.out.contains("module_line2")); - let actual = nu!(cwd: dirs.test(), - "use spam.nu *; help modules | where name == spam | get 0.usage"); - assert!(actual.out.contains("module_line1")); - assert!(!actual.out.contains("module_line2")); + let actual = nu!(cwd: dirs.test(), + "use spam.nu *; help modules | where name == spam | get 0.description"); + assert!(actual.out.contains("module_line1")); + assert!(!actual.out.contains("module_line2")); - let actual = nu!(cwd: dirs.test(), "use spam.nu *; help aliases bar"); - assert!(actual.out.contains("alias_line1")); - assert!(actual.out.contains("alias_line2")); + let actual = nu!(cwd: dirs.test(), "use spam.nu *; help aliases bar"); + assert!(actual.out.contains("alias_line1")); + assert!(actual.out.contains("alias_line2")); - let actual = nu!(cwd: dirs.test(), - "use spam.nu *; help aliases | where name == bar | get 0.usage"); - assert!(actual.out.contains("alias_line1")); - assert!(!actual.out.contains("alias_line2")); - }) + let actual = nu!(cwd: dirs.test(), + "use spam.nu *; help aliases | where name == bar | get 0.description"); + assert!(actual.out.contains("alias_line1")); + assert!(!actual.out.contains("alias_line2")); + }, + ) } #[test] diff --git a/crates/nu-command/tests/main.rs b/crates/nu-command/tests/main.rs index 1039e1a0d7..248151e74a 100644 --- a/crates/nu-command/tests/main.rs +++ b/crates/nu-command/tests/main.rs @@ -197,7 +197,7 @@ fn no_search_term_duplicates() { } #[test] -fn usage_end_period() { +fn description_end_period() { let ctx = crate::create_default_context(); let decls = ctx.get_decls_sorted(true); let mut failures = Vec::new(); @@ -205,22 +205,22 @@ fn usage_end_period() { for (name_bytes, decl_id) in decls { let cmd = ctx.get_decl(decl_id); let cmd_name = String::from_utf8_lossy(&name_bytes); - let usage = cmd.usage(); + let description = cmd.description(); - if !usage.ends_with('.') { - failures.push(format!("{cmd_name}: \"{usage}\"")); + if !description.ends_with('.') { + failures.push(format!("{cmd_name}: \"{description}\"")); } } assert!( failures.is_empty(), - "Command usage does not end with a period:\n{}", + "Command description does not end with a period:\n{}", failures.join("\n") ); } #[test] -fn usage_start_uppercase() { +fn description_start_uppercase() { let ctx = crate::create_default_context(); let decls = ctx.get_decls_sorted(true); let mut failures = Vec::new(); @@ -228,19 +228,19 @@ fn usage_start_uppercase() { for (name_bytes, decl_id) in decls { let cmd = ctx.get_decl(decl_id); let cmd_name = String::from_utf8_lossy(&name_bytes); - let usage = cmd.usage(); + let description = cmd.description(); - // Check lowercase to allow usage to contain syntax like: + // Check lowercase to allow description to contain syntax like: // // "`$env.FOO = ...`" - if usage.starts_with(|u: char| u.is_lowercase()) { - failures.push(format!("{cmd_name}: \"{usage}\"")); + if description.starts_with(|u: char| u.is_lowercase()) { + failures.push(format!("{cmd_name}: \"{description}\"")); } } assert!( failures.is_empty(), - "Command usage does not start with an uppercase letter:\n{}", + "Command description does not start with an uppercase letter:\n{}", failures.join("\n") ); } diff --git a/crates/nu-engine/src/documentation.rs b/crates/nu-engine/src/documentation.rs index 3d5381dd9d..370b00e3f9 100644 --- a/crates/nu-engine/src/documentation.rs +++ b/crates/nu-engine/src/documentation.rs @@ -76,15 +76,15 @@ fn get_documentation( let cmd_name = &sig.name; let mut long_desc = String::new(); - let usage = &sig.usage; - if !usage.is_empty() { - long_desc.push_str(usage); + let desc = &sig.description; + if !desc.is_empty() { + long_desc.push_str(desc); long_desc.push_str("\n\n"); } - let extra_usage = &sig.extra_usage; - if !extra_usage.is_empty() { - long_desc.push_str(extra_usage); + let extra_desc = &sig.extra_description; + if !extra_desc.is_empty() { + long_desc.push_str(extra_desc); long_desc.push_str("\n\n"); } @@ -118,7 +118,7 @@ fn get_documentation( { subcommands.push(format!( " {help_subcolor_one}{}{RESET} - {}", - sig.name, sig.usage + sig.name, sig.description )); } } diff --git a/crates/nu-engine/src/scope.rs b/crates/nu-engine/src/scope.rs index b6a43ca47c..d9650d2c28 100644 --- a/crates/nu-engine/src/scope.rs +++ b/crates/nu-engine/src/scope.rs @@ -109,12 +109,12 @@ impl<'e, 's> ScopeData<'e, 's> { "name" => Value::string(String::from_utf8_lossy(command_name), span), "category" => Value::string(signature.category.to_string(), span), "signatures" => self.collect_signatures(&signature, span), - "usage" => Value::string(decl.usage(), span), + "description" => Value::string(decl.description(), span), "examples" => Value::list(examples, span), "type" => Value::string(decl.command_type().to_string(), span), "is_sub" => Value::bool(decl.is_sub(), span), "creates_scope" => Value::bool(signature.creates_scope, span), - "extra_usage" => Value::string(decl.extra_usage(), span), + "extra_description" => Value::string(decl.extra_description(), span), "search_terms" => Value::string(decl.search_terms().join(", "), span), "decl_id" => Value::int(**decl_id as i64, span), }; @@ -332,7 +332,7 @@ impl<'e, 's> ScopeData<'e, 's> { if decl.is_known_external() { let record = record! { "name" => Value::string(String::from_utf8_lossy(command_name), span), - "usage" => Value::string(decl.usage(), span), + "description" => Value::string(decl.description(), span), "decl_id" => Value::int(**decl_id as i64, span), }; @@ -366,7 +366,7 @@ impl<'e, 's> ScopeData<'e, 's> { record! { "name" => Value::string(String::from_utf8_lossy(&decl_name), span), "expansion" => Value::string(expansion, span), - "usage" => Value::string(alias.usage(), span), + "description" => Value::string(alias.description(), span), "decl_id" => Value::int(decl_id as i64, span), "aliased_decl_id" => aliased_decl_id, }, @@ -470,9 +470,9 @@ impl<'e, 's> ScopeData<'e, 's> { sort_rows(&mut export_submodules); sort_rows(&mut export_consts); - let (module_usage, module_extra_usage) = self + let (module_desc, module_extra_desc) = self .engine_state - .build_module_usage(*module_id) + .build_module_desc(*module_id) .unwrap_or_default(); Value::record( @@ -484,8 +484,8 @@ impl<'e, 's> ScopeData<'e, 's> { "submodules" => Value::list(export_submodules, span), "constants" => Value::list(export_consts, span), "has_env_block" => Value::bool(module.env_block.is_some(), span), - "usage" => Value::string(module_usage, span), - "extra_usage" => Value::string(module_extra_usage, span), + "description" => Value::string(module_desc, span), + "extra_description" => Value::string(module_extra_desc, span), "module_id" => Value::int(*module_id as i64, span), }, span, diff --git a/crates/nu-explore/src/commands/expand.rs b/crates/nu-explore/src/commands/expand.rs index 38f92c0b50..8b03b71dc1 100644 --- a/crates/nu-explore/src/commands/expand.rs +++ b/crates/nu-explore/src/commands/expand.rs @@ -30,7 +30,7 @@ impl ViewCommand for ExpandCmd { Self::NAME } - fn usage(&self) -> &'static str { + fn description(&self) -> &'static str { "" } diff --git a/crates/nu-explore/src/commands/help.rs b/crates/nu-explore/src/commands/help.rs index 684e713939..721c2924a5 100644 --- a/crates/nu-explore/src/commands/help.rs +++ b/crates/nu-explore/src/commands/help.rs @@ -91,7 +91,7 @@ impl ViewCommand for HelpCmd { Self::NAME } - fn usage(&self) -> &'static str { + fn description(&self) -> &'static str { "" } diff --git a/crates/nu-explore/src/commands/mod.rs b/crates/nu-explore/src/commands/mod.rs index a748ddaaa3..8dafd83993 100644 --- a/crates/nu-explore/src/commands/mod.rs +++ b/crates/nu-explore/src/commands/mod.rs @@ -24,7 +24,7 @@ pub use table::TableCmd; pub trait SimpleCommand { fn name(&self) -> &'static str; - fn usage(&self) -> &'static str; + fn description(&self) -> &'static str; fn parse(&mut self, args: &str) -> Result<()>; @@ -42,7 +42,7 @@ pub trait ViewCommand { fn name(&self) -> &'static str; - fn usage(&self) -> &'static str; + fn description(&self) -> &'static str; fn parse(&mut self, args: &str) -> Result<()>; diff --git a/crates/nu-explore/src/commands/nu.rs b/crates/nu-explore/src/commands/nu.rs index 84e1fb9706..8b5bc71f69 100644 --- a/crates/nu-explore/src/commands/nu.rs +++ b/crates/nu-explore/src/commands/nu.rs @@ -33,7 +33,7 @@ impl ViewCommand for NuCmd { Self::NAME } - fn usage(&self) -> &'static str { + fn description(&self) -> &'static str { "" } diff --git a/crates/nu-explore/src/commands/quit.rs b/crates/nu-explore/src/commands/quit.rs index e93a6a2dd1..03c1c18381 100644 --- a/crates/nu-explore/src/commands/quit.rs +++ b/crates/nu-explore/src/commands/quit.rs @@ -18,7 +18,7 @@ impl SimpleCommand for QuitCmd { Self::NAME } - fn usage(&self) -> &'static str { + fn description(&self) -> &'static str { "" } diff --git a/crates/nu-explore/src/commands/table.rs b/crates/nu-explore/src/commands/table.rs index 9ab1e39b98..1e4adeb0cb 100644 --- a/crates/nu-explore/src/commands/table.rs +++ b/crates/nu-explore/src/commands/table.rs @@ -36,7 +36,7 @@ impl ViewCommand for TableCmd { Self::NAME } - fn usage(&self) -> &'static str { + fn description(&self) -> &'static str { "" } diff --git a/crates/nu-explore/src/commands/try.rs b/crates/nu-explore/src/commands/try.rs index e1290651c8..6694125bab 100644 --- a/crates/nu-explore/src/commands/try.rs +++ b/crates/nu-explore/src/commands/try.rs @@ -28,7 +28,7 @@ impl ViewCommand for TryCmd { Self::NAME } - fn usage(&self) -> &'static str { + fn description(&self) -> &'static str { "" } diff --git a/crates/nu-explore/src/explore.rs b/crates/nu-explore/src/explore.rs index 28a3f04a30..3fdd9835d8 100644 --- a/crates/nu-explore/src/explore.rs +++ b/crates/nu-explore/src/explore.rs @@ -17,7 +17,7 @@ impl Command for Explore { "explore" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Explore acts as a table pager, just like `less` does for text." } @@ -47,7 +47,7 @@ impl Command for Explore { .category(Category::Viewers) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"Press `:` then `h` to get a help menu."# } diff --git a/crates/nu-explore/src/registry/command.rs b/crates/nu-explore/src/registry/command.rs index 6a3e9a128f..17fcd863f2 100644 --- a/crates/nu-explore/src/registry/command.rs +++ b/crates/nu-explore/src/registry/command.rs @@ -65,8 +65,8 @@ where self.0.name() } - fn usage(&self) -> &'static str { - self.0.usage() + fn description(&self) -> &'static str { + self.0.description() } fn parse(&mut self, args: &str) -> Result<()> { diff --git a/crates/nu-lsp/src/lib.rs b/crates/nu-lsp/src/lib.rs index 6841749fc9..d698b126e0 100644 --- a/crates/nu-lsp/src/lib.rs +++ b/crates/nu-lsp/src/lib.rs @@ -353,11 +353,11 @@ impl LanguageServer { let mut description = String::new(); // First description - description.push_str(&format!("{}\n", decl.usage().replace('\r', ""))); + description.push_str(&format!("{}\n", decl.description().replace('\r', ""))); // Additional description - if !decl.extra_usage().is_empty() { - description.push_str(&format!("\n{}\n", decl.extra_usage())); + if !decl.extra_description().is_empty() { + description.push_str(&format!("\n{}\n", decl.extra_description())); } // Usage diff --git a/crates/nu-parser/src/known_external.rs b/crates/nu-parser/src/known_external.rs index a41cf3a4e8..7ba73f453b 100644 --- a/crates/nu-parser/src/known_external.rs +++ b/crates/nu-parser/src/known_external.rs @@ -9,8 +9,8 @@ use nu_protocol::{ pub struct KnownExternal { pub name: String, pub signature: Box, - pub usage: String, - pub extra_usage: String, + pub description: String, + pub extra_description: String, } impl Command for KnownExternal { @@ -22,8 +22,8 @@ impl Command for KnownExternal { *self.signature.clone() } - fn usage(&self) -> &str { - &self.usage + fn description(&self) -> &str { + &self.description } fn command_type(&self) -> CommandType { diff --git a/crates/nu-parser/src/parse_keywords.rs b/crates/nu-parser/src/parse_keywords.rs index b4506e7f7d..b75a57a286 100644 --- a/crates/nu-parser/src/parse_keywords.rs +++ b/crates/nu-parser/src/parse_keywords.rs @@ -371,7 +371,7 @@ pub fn parse_def( ) -> (Pipeline, Option<(Vec, DeclId)>) { let spans = &lite_command.parts[..]; - let (usage, extra_usage) = working_set.build_usage(&lite_command.comments); + let (desc, extra_desc) = working_set.build_desc(&lite_command.comments); // Checking that the function is used with the correct name // Maybe this is not necessary but it is a sanity check @@ -599,8 +599,8 @@ pub fn parse_def( if !has_wrapped { *signature = signature.add_help(); } - signature.usage = usage; - signature.extra_usage = extra_usage; + signature.description = desc; + signature.extra_description = extra_desc; signature.allows_unknown_args = has_wrapped; *declaration = signature.clone().into_block_command(block_id); @@ -654,7 +654,7 @@ pub fn parse_extern( ) -> Pipeline { let spans = &lite_command.parts; - let (usage, extra_usage) = working_set.build_usage(&lite_command.comments); + let (description, extra_description) = working_set.build_desc(&lite_command.comments); // Checking that the function is used with the correct name // Maybe this is not necessary but it is a sanity check @@ -759,8 +759,8 @@ pub fn parse_extern( }; signature.name.clone_from(&external_name); - signature.usage.clone_from(&usage); - signature.extra_usage.clone_from(&extra_usage); + signature.description.clone_from(&description); + signature.extra_description.clone_from(&extra_description); signature.allows_unknown_args = true; if let Some(block_id) = body.and_then(|x| x.as_block()) { @@ -787,8 +787,8 @@ pub fn parse_extern( let decl = KnownExternal { name: external_name, - usage, - extra_usage, + description, + extra_description, signature, }; @@ -1052,10 +1052,10 @@ pub fn parse_alias( } }; - // Tries to build a useful usage string - let (usage, extra_usage) = match lite_command.comments.is_empty() { + // Tries to build a useful description string + let (description, extra_description) = match lite_command.comments.is_empty() { // First from comments, if any are present - false => working_set.build_usage(&lite_command.comments), + false => working_set.build_desc(&lite_command.comments), // Then from the command itself true => match alias_call.arguments.get(1) { Some(Argument::Positional(Expression { @@ -1077,8 +1077,8 @@ pub fn parse_alias( name: alias_name, command, wrapped_call, - usage, - extra_usage, + description, + extra_description, }; working_set.add_decl(Box::new(decl)); diff --git a/crates/nu-parser/tests/test_parser.rs b/crates/nu-parser/tests/test_parser.rs index f72b52b433..ed0a288a47 100644 --- a/crates/nu-parser/tests/test_parser.rs +++ b/crates/nu-parser/tests/test_parser.rs @@ -16,7 +16,7 @@ impl Command for Let { "let" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Create a variable and give it a value." } @@ -51,7 +51,7 @@ impl Command for Mut { "mut" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Mock mut command." } @@ -84,7 +84,7 @@ impl Command for ToCustom { "to-custom" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Mock converter command." } @@ -1903,7 +1903,7 @@ mod input_types { "ls" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Mock ls command." } @@ -1930,7 +1930,7 @@ mod input_types { "def" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Mock def command." } @@ -1962,7 +1962,7 @@ mod input_types { "group-by" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Mock group-by command." } @@ -1983,6 +1983,35 @@ mod input_types { } } + #[derive(Clone)] + pub struct ToCustom; + + impl Command for ToCustom { + fn name(&self) -> &str { + "to-custom" + } + + fn description(&self) -> &str { + "Mock converter command." + } + + fn signature(&self) -> nu_protocol::Signature { + Signature::build(self.name()) + .input_output_type(Type::Any, Type::Custom("custom".into())) + .category(Category::Custom("custom".into())) + } + + fn run( + &self, + _engine_state: &EngineState, + _stack: &mut Stack, + _call: &Call, + _input: PipelineData, + ) -> Result { + todo!() + } + } + #[derive(Clone)] pub struct GroupByCustom; @@ -1991,7 +2020,7 @@ mod input_types { "group-by" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Mock custom group-by command." } @@ -2022,7 +2051,7 @@ mod input_types { "agg" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Mock custom agg command." } @@ -2052,7 +2081,7 @@ mod input_types { "min" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Mock custom min command." } @@ -2079,7 +2108,7 @@ mod input_types { "with-column" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Mock custom with-column command." } @@ -2109,7 +2138,7 @@ mod input_types { "collect" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Mock custom collect command." } @@ -2138,7 +2167,7 @@ mod input_types { "if" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Mock if command." } diff --git a/crates/nu-plugin-core/src/serializers/tests.rs b/crates/nu-plugin-core/src/serializers/tests.rs index 5d0c07cceb..b27f852ee4 100644 --- a/crates/nu-plugin-core/src/serializers/tests.rs +++ b/crates/nu-plugin-core/src/serializers/tests.rs @@ -254,10 +254,13 @@ macro_rules! generate_tests { ) => { assert_eq!(returned_signature.len(), 1); assert_eq!(signature.sig.name, returned_signature[0].sig.name); - assert_eq!(signature.sig.usage, returned_signature[0].sig.usage); assert_eq!( - signature.sig.extra_usage, - returned_signature[0].sig.extra_usage + signature.sig.description, + returned_signature[0].sig.description + ); + assert_eq!( + signature.sig.extra_description, + returned_signature[0].sig.extra_description ); assert_eq!(signature.sig.is_filter, returned_signature[0].sig.is_filter); diff --git a/crates/nu-plugin-engine/src/declaration.rs b/crates/nu-plugin-engine/src/declaration.rs index 745ba9a998..987835823f 100644 --- a/crates/nu-plugin-engine/src/declaration.rs +++ b/crates/nu-plugin-engine/src/declaration.rs @@ -32,12 +32,12 @@ impl Command for PluginDeclaration { self.signature.sig.clone() } - fn usage(&self) -> &str { - self.signature.sig.usage.as_str() + fn description(&self) -> &str { + self.signature.sig.description.as_str() } - fn extra_usage(&self) -> &str { - self.signature.sig.extra_usage.as_str() + fn extra_description(&self) -> &str { + self.signature.sig.extra_description.as_str() } fn search_terms(&self) -> Vec<&str> { diff --git a/crates/nu-plugin-test-support/src/lib.rs b/crates/nu-plugin-test-support/src/lib.rs index 998c31ac0d..14e6acd9b7 100644 --- a/crates/nu-plugin-test-support/src/lib.rs +++ b/crates/nu-plugin-test-support/src/lib.rs @@ -22,7 +22,7 @@ //! "lowercase" //! } //! -//! fn usage(&self) -> &str { +//! fn description(&self) -> &str { //! "Convert each string in a stream to lowercase" //! } //! diff --git a/crates/nu-plugin-test-support/tests/custom_value/mod.rs b/crates/nu-plugin-test-support/tests/custom_value/mod.rs index 888f05c1cb..3547b986e7 100644 --- a/crates/nu-plugin-test-support/tests/custom_value/mod.rs +++ b/crates/nu-plugin-test-support/tests/custom_value/mod.rs @@ -69,7 +69,7 @@ impl SimplePluginCommand for IntoU32 { "into u32" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert a number to a 32-bit unsigned integer" } @@ -108,7 +108,7 @@ impl SimplePluginCommand for IntoIntFromU32 { "into int from u32" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Turn a u32 back into a number" } diff --git a/crates/nu-plugin-test-support/tests/hello/mod.rs b/crates/nu-plugin-test-support/tests/hello/mod.rs index a222637a76..b7e7474300 100644 --- a/crates/nu-plugin-test-support/tests/hello/mod.rs +++ b/crates/nu-plugin-test-support/tests/hello/mod.rs @@ -24,7 +24,7 @@ impl SimplePluginCommand for Hello { "hello" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Print a friendly greeting" } diff --git a/crates/nu-plugin-test-support/tests/lowercase/mod.rs b/crates/nu-plugin-test-support/tests/lowercase/mod.rs index 5be127e7f5..0147ebb4d9 100644 --- a/crates/nu-plugin-test-support/tests/lowercase/mod.rs +++ b/crates/nu-plugin-test-support/tests/lowercase/mod.rs @@ -15,7 +15,7 @@ impl PluginCommand for Lowercase { "lowercase" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert each string in a stream to lowercase" } diff --git a/crates/nu-plugin/src/lib.rs b/crates/nu-plugin/src/lib.rs index 4c1a033a02..98b88e1359 100644 --- a/crates/nu-plugin/src/lib.rs +++ b/crates/nu-plugin/src/lib.rs @@ -40,7 +40,7 @@ //! "my-command" //! } //! -//! fn usage(&self) -> &str { +//! fn description(&self) -> &str { //! todo!(); //! } //! diff --git a/crates/nu-plugin/src/plugin/command.rs b/crates/nu-plugin/src/plugin/command.rs index 8e8adc9578..d40005fa52 100644 --- a/crates/nu-plugin/src/plugin/command.rs +++ b/crates/nu-plugin/src/plugin/command.rs @@ -33,7 +33,7 @@ use crate::{EngineInterface, EvaluatedCall, Plugin}; /// "lowercase" /// } /// -/// fn usage(&self) -> &str { +/// fn description(&self) -> &str { /// "Convert each string in a stream to lowercase" /// } /// @@ -92,14 +92,14 @@ pub trait PluginCommand: Sync { /// A brief description of usage for the command. /// /// This should be short enough to fit in completion menus. - fn usage(&self) -> &str; + fn description(&self) -> &str; /// Additional documentation for usage of the command. /// /// This is optional - any arguments documented by [`.signature()`](Self::signature) will be /// shown in the help page automatically. However, this can be useful for explaining things that - /// would be too brief to include in [`.usage()`](Self::usage) and may span multiple lines. - fn extra_usage(&self) -> &str { + /// would be too brief to include in [`.description()`](Self::description) and may span multiple lines. + fn extra_description(&self) -> &str { "" } @@ -177,7 +177,7 @@ pub trait PluginCommand: Sync { /// "hello" /// } /// -/// fn usage(&self) -> &str { +/// fn description(&self) -> &str { /// "Every programmer's favorite greeting" /// } /// @@ -230,14 +230,14 @@ pub trait SimplePluginCommand: Sync { /// A brief description of usage for the command. /// /// This should be short enough to fit in completion menus. - fn usage(&self) -> &str; + fn description(&self) -> &str; /// Additional documentation for usage of the command. /// /// This is optional - any arguments documented by [`.signature()`] will be shown in the help /// page automatically. However, this can be useful for explaining things that would be too - /// brief to include in [`.usage()`] and may span multiple lines. - fn extra_usage(&self) -> &str { + /// brief to include in [`.description()`](Self::description) and may span multiple lines. + fn extra_description(&self) -> &str { "" } @@ -301,8 +301,8 @@ where ::examples(self) } - fn extra_usage(&self) -> &str { - ::extra_usage(self) + fn extra_description(&self) -> &str { + ::extra_description(self) } fn name(&self) -> &str { @@ -333,8 +333,8 @@ where ::signature(self) } - fn usage(&self) -> &str { - ::usage(self) + fn description(&self) -> &str { + ::description(self) } } @@ -349,8 +349,8 @@ pub fn create_plugin_signature(command: &(impl PluginCommand + ?Sized)) -> Plugi // Add results of trait methods to signature command .signature() - .usage(command.usage()) - .extra_usage(command.extra_usage()) + .description(command.description()) + .extra_description(command.extra_description()) .search_terms( command .search_terms() diff --git a/crates/nu-plugin/src/plugin/mod.rs b/crates/nu-plugin/src/plugin/mod.rs index 87f95cf7d4..340d55e3b9 100644 --- a/crates/nu-plugin/src/plugin/mod.rs +++ b/crates/nu-plugin/src/plugin/mod.rs @@ -69,7 +69,7 @@ pub(crate) const OUTPUT_BUFFER_SIZE: usize = 16384; /// "hello" /// } /// -/// fn usage(&self) -> &str { +/// fn description(&self) -> &str { /// "Every programmer's favorite greeting" /// } /// @@ -662,10 +662,14 @@ fn print_help(plugin: &impl Plugin, encoder: impl PluginEncoder) { plugin.commands().into_iter().for_each(|command| { let signature = command.signature(); let res = write!(help, "\nCommand: {}", command.name()) - .and_then(|_| writeln!(help, "\nUsage:\n > {}", command.usage())) + .and_then(|_| writeln!(help, "\nDescription:\n > {}", command.description())) .and_then(|_| { - if !command.extra_usage().is_empty() { - writeln!(help, "\nExtra usage:\n > {}", command.extra_usage()) + if !command.extra_description().is_empty() { + writeln!( + help, + "\nExtra description:\n > {}", + command.extra_description() + ) } else { Ok(()) } diff --git a/crates/nu-protocol/src/alias.rs b/crates/nu-protocol/src/alias.rs index 701543c57b..2da569b8ea 100644 --- a/crates/nu-protocol/src/alias.rs +++ b/crates/nu-protocol/src/alias.rs @@ -15,8 +15,8 @@ pub struct Alias { /// Wrapped inner [`Command`]. `None` if alias of external call pub command: Option>, pub wrapped_call: Expression, - pub usage: String, - pub extra_usage: String, + pub description: String, + pub extra_description: String, } impl Command for Alias { @@ -32,12 +32,12 @@ impl Command for Alias { } } - fn usage(&self) -> &str { - &self.usage + fn description(&self) -> &str { + &self.description } - fn extra_usage(&self) -> &str { - &self.extra_usage + fn extra_description(&self) -> &str { + &self.extra_description } fn run( diff --git a/crates/nu-protocol/src/engine/command.rs b/crates/nu-protocol/src/engine/command.rs index 48cdc4440d..be80a18bc4 100644 --- a/crates/nu-protocol/src/engine/command.rs +++ b/crates/nu-protocol/src/engine/command.rs @@ -31,9 +31,15 @@ pub trait Command: Send + Sync + CommandClone { fn signature(&self) -> Signature; - fn usage(&self) -> &str; + /// Short preferably single sentence description for the command. + /// + /// Will be shown with the completions etc. + fn description(&self) -> &str; - fn extra_usage(&self) -> &str { + /// Longer documentation description, if necessary. + /// + /// Will be shown below `description` + fn extra_description(&self) -> &str { "" } diff --git a/crates/nu-protocol/src/engine/usage.rs b/crates/nu-protocol/src/engine/description.rs similarity index 66% rename from crates/nu-protocol/src/engine/usage.rs rename to crates/nu-protocol/src/engine/description.rs index 76f50d2424..ede82955e1 100644 --- a/crates/nu-protocol/src/engine/usage.rs +++ b/crates/nu-protocol/src/engine/description.rs @@ -1,16 +1,16 @@ use crate::{ModuleId, Span}; use std::collections::HashMap; -/// Organizes usage messages for various primitives +/// Organizes documentation comments for various primitives #[derive(Debug, Clone)] -pub(super) struct Usage { - // TODO: Move decl usages here +pub(super) struct Doccomments { + // TODO: Move decl doccomments here module_comments: HashMap>, } -impl Usage { +impl Doccomments { pub fn new() -> Self { - Usage { + Doccomments { module_comments: HashMap::new(), } } @@ -24,24 +24,24 @@ impl Usage { } /// Overwrite own values with the other - pub fn merge_with(&mut self, other: Usage) { + pub fn merge_with(&mut self, other: Doccomments) { self.module_comments.extend(other.module_comments); } } -impl Default for Usage { +impl Default for Doccomments { fn default() -> Self { Self::new() } } -pub(super) fn build_usage(comment_lines: &[&[u8]]) -> (String, String) { - let mut usage = String::new(); +pub(super) fn build_desc(comment_lines: &[&[u8]]) -> (String, String) { + let mut description = String::new(); let mut num_spaces = 0; let mut first = true; - // Use the comments to build the usage + // Use the comments to build the item/command description for contents in comment_lines { let comment_line = if first { // Count the number of spaces still at the front, skipping the '#' @@ -75,17 +75,17 @@ pub(super) fn build_usage(comment_lines: &[&[u8]]) -> (String, String) { String::from_utf8_lossy(&contents[pos..]).to_string() }; - if !usage.is_empty() { - usage.push('\n'); + if !description.is_empty() { + description.push('\n'); } - usage.push_str(&comment_line); + description.push_str(&comment_line); } - if let Some((brief_usage, extra_usage)) = usage.split_once("\r\n\r\n") { - (brief_usage.to_string(), extra_usage.to_string()) - } else if let Some((brief_usage, extra_usage)) = usage.split_once("\n\n") { - (brief_usage.to_string(), extra_usage.to_string()) + if let Some((brief_desc, extra_desc)) = description.split_once("\r\n\r\n") { + (brief_desc.to_string(), extra_desc.to_string()) + } else if let Some((brief_desc, extra_desc)) = description.split_once("\n\n") { + (brief_desc.to_string(), extra_desc.to_string()) } else { - (usage, String::default()) + (description, String::default()) } } diff --git a/crates/nu-protocol/src/engine/engine_state.rs b/crates/nu-protocol/src/engine/engine_state.rs index 405b702c12..cf24a26859 100644 --- a/crates/nu-protocol/src/engine/engine_state.rs +++ b/crates/nu-protocol/src/engine/engine_state.rs @@ -2,7 +2,7 @@ use crate::{ ast::Block, debugger::{Debugger, NoopDebugger}, engine::{ - usage::{build_usage, Usage}, + description::{build_desc, Doccomments}, CachedFile, Command, CommandType, EnvVars, OverlayFrame, ScopeFrame, Stack, StateDelta, Variable, Visibility, DEFAULT_OVERLAY_NAME, }, @@ -84,7 +84,7 @@ pub struct EngineState { pub(super) blocks: Arc>>, pub(super) modules: Arc>>, pub spans: Vec, - usage: Usage, + doccomments: Doccomments, pub scope: ScopeFrame, signals: Signals, pub signal_handlers: Option, @@ -140,7 +140,7 @@ impl EngineState { DEFAULT_OVERLAY_NAME.as_bytes().to_vec(), ))]), spans: vec![Span::unknown()], - usage: Usage::new(), + doccomments: Doccomments::new(), // make sure we have some default overlay: scope: ScopeFrame::with_empty_overlay( DEFAULT_OVERLAY_NAME.as_bytes().to_vec(), @@ -209,7 +209,7 @@ impl EngineState { self.virtual_paths.extend(delta.virtual_paths); self.vars.extend(delta.vars); self.spans.extend(delta.spans); - self.usage.merge_with(delta.usage); + self.doccomments.merge_with(delta.doccomments); // Avoid potentially cloning the Arcs if we aren't adding anything if !delta.decls.is_empty() { @@ -644,7 +644,7 @@ impl EngineState { } pub fn get_module_comments(&self, module_id: ModuleId) -> Option<&[Span]> { - self.usage.get_module_comments(module_id) + self.doccomments.get_module_comments(module_id) } #[cfg(feature = "plugin")] @@ -715,7 +715,7 @@ impl EngineState { } output.push(( decl.0.clone(), - Some(command.usage().to_string()), + Some(command.description().to_string()), command.command_type(), )); } @@ -897,17 +897,17 @@ impl EngineState { self.config_path.get(key) } - pub fn build_usage(&self, spans: &[Span]) -> (String, String) { + pub fn build_desc(&self, spans: &[Span]) -> (String, String) { let comment_lines: Vec<&[u8]> = spans .iter() .map(|span| self.get_span_contents(*span)) .collect(); - build_usage(&comment_lines) + build_desc(&comment_lines) } - pub fn build_module_usage(&self, module_id: ModuleId) -> Option<(String, String)> { + pub fn build_module_desc(&self, module_id: ModuleId) -> Option<(String, String)> { self.get_module_comments(module_id) - .map(|comment_spans| self.build_usage(comment_spans)) + .map(|comment_spans| self.build_desc(comment_spans)) } /// Returns the current working directory, which is guaranteed to be canonicalized. diff --git a/crates/nu-protocol/src/engine/mod.rs b/crates/nu-protocol/src/engine/mod.rs index 0cf45217ea..e0d523f2f6 100644 --- a/crates/nu-protocol/src/engine/mod.rs +++ b/crates/nu-protocol/src/engine/mod.rs @@ -5,6 +5,7 @@ mod call; mod call_info; mod capture_block; mod command; +mod description; mod engine_state; mod error_handler; mod overlay; @@ -14,7 +15,6 @@ mod stack; mod stack_out_dest; mod state_delta; mod state_working_set; -mod usage; mod variable; pub use cached_file::CachedFile; diff --git a/crates/nu-protocol/src/engine/state_delta.rs b/crates/nu-protocol/src/engine/state_delta.rs index 44c1b37386..033867e4c0 100644 --- a/crates/nu-protocol/src/engine/state_delta.rs +++ b/crates/nu-protocol/src/engine/state_delta.rs @@ -1,8 +1,8 @@ use crate::{ ast::Block, engine::{ - usage::Usage, CachedFile, Command, EngineState, OverlayFrame, ScopeFrame, Variable, - VirtualPath, + description::Doccomments, CachedFile, Command, EngineState, OverlayFrame, ScopeFrame, + Variable, VirtualPath, }, Module, Span, }; @@ -22,7 +22,7 @@ pub struct StateDelta { pub blocks: Vec>, // indexed by BlockId pub(super) modules: Vec>, // indexed by ModuleId pub spans: Vec, // indexed by SpanId - pub(super) usage: Usage, + pub(super) doccomments: Doccomments, pub scope: Vec, #[cfg(feature = "plugin")] pub(super) plugins: Vec>, @@ -48,7 +48,7 @@ impl StateDelta { modules: vec![], spans: vec![], scope: vec![scope_frame], - usage: Usage::new(), + doccomments: Doccomments::new(), #[cfg(feature = "plugin")] plugins: vec![], #[cfg(feature = "plugin")] diff --git a/crates/nu-protocol/src/engine/state_working_set.rs b/crates/nu-protocol/src/engine/state_working_set.rs index 822bf35e3a..2ffcfa023b 100644 --- a/crates/nu-protocol/src/engine/state_working_set.rs +++ b/crates/nu-protocol/src/engine/state_working_set.rs @@ -1,7 +1,7 @@ use crate::{ ast::Block, engine::{ - usage::build_usage, CachedFile, Command, CommandType, EngineState, OverlayFrame, + description::build_desc, CachedFile, Command, CommandType, EngineState, OverlayFrame, StateDelta, Variable, VirtualPath, Visibility, }, BlockId, Category, CompileError, Config, DeclId, FileId, GetSpan, Module, ModuleId, ParseError, @@ -278,7 +278,9 @@ impl<'a> StateWorkingSet<'a> { let module_id = self.num_modules() - 1; if !comments.is_empty() { - self.delta.usage.add_module_comments(module_id, comments); + self.delta + .doccomments + .add_module_comments(module_id, comments); } self.last_overlay_mut().modules.insert(name, module_id); @@ -288,7 +290,7 @@ impl<'a> StateWorkingSet<'a> { pub fn get_module_comments(&self, module_id: ModuleId) -> Option<&[Span]> { self.delta - .usage + .doccomments .get_module_comments(module_id) .or_else(|| self.permanent_state.get_module_comments(module_id)) } @@ -727,7 +729,7 @@ impl<'a> StateWorkingSet<'a> { } output.push(( decl.0.clone(), - Some(command.usage().to_string()), + Some(command.description().to_string()), command.command_type(), )); } @@ -952,12 +954,12 @@ impl<'a> StateWorkingSet<'a> { self.delta } - pub fn build_usage(&self, spans: &[Span]) -> (String, String) { + pub fn build_desc(&self, spans: &[Span]) -> (String, String) { let comment_lines: Vec<&[u8]> = spans .iter() .map(|span| self.get_span_contents(*span)) .collect(); - build_usage(&comment_lines) + build_desc(&comment_lines) } pub fn find_block_by_span(&self, span: Span) -> Option> { diff --git a/crates/nu-protocol/src/plugin/registry_file/tests.rs b/crates/nu-protocol/src/plugin/registry_file/tests.rs index e264e4463d..d13cdaefa1 100644 --- a/crates/nu-protocol/src/plugin/registry_file/tests.rs +++ b/crates/nu-protocol/src/plugin/registry_file/tests.rs @@ -45,7 +45,7 @@ fn bar_plugin() -> PluginRegistryItem { }, commands: vec![PluginSignature { sig: Signature::new("bar") - .usage("overwrites files with random data") + .description("overwrites files with random data") .switch("force", "ignore errors", Some('f')) .required( "path", diff --git a/crates/nu-protocol/src/signature.rs b/crates/nu-protocol/src/signature.rs index c67e8a604e..4c5cae9e03 100644 --- a/crates/nu-protocol/src/signature.rs +++ b/crates/nu-protocol/src/signature.rs @@ -109,8 +109,8 @@ impl std::fmt::Display for Category { #[derive(Clone, Debug, Serialize, Deserialize)] pub struct Signature { pub name: String, - pub usage: String, - pub extra_usage: String, + pub description: String, + pub extra_description: String, pub search_terms: Vec, pub required_positional: Vec, pub optional_positional: Vec, @@ -128,7 +128,7 @@ pub struct Signature { impl PartialEq for Signature { fn eq(&self, other: &Self) -> bool { self.name == other.name - && self.usage == other.usage + && self.description == other.description && self.required_positional == other.required_positional && self.optional_positional == other.optional_positional && self.rest_positional == other.rest_positional @@ -142,8 +142,8 @@ impl Signature { pub fn new(name: impl Into) -> Signature { Signature { name: name.into(), - usage: String::new(), - extra_usage: String::new(), + description: String::new(), + extra_description: String::new(), search_terms: vec![], required_positional: vec![], optional_positional: vec![], @@ -220,14 +220,19 @@ impl Signature { } /// Add a description to the signature - pub fn usage(mut self, msg: impl Into) -> Signature { - self.usage = msg.into(); + /// + /// This should be a single sentence as it is the part shown for example in the completion + /// menu. + pub fn description(mut self, msg: impl Into) -> Signature { + self.description = msg.into(); self } - /// Add an extra description to the signature - pub fn extra_usage(mut self, msg: impl Into) -> Signature { - self.extra_usage = msg.into(); + /// Add an extra description to the signature. + /// + /// Here additional documentation can be added + pub fn extra_description(mut self, msg: impl Into) -> Signature { + self.extra_description = msg.into(); self } @@ -244,8 +249,8 @@ impl Signature { .into_iter() .map(|term| term.to_string()) .collect(); - self.extra_usage = command.extra_usage().to_string(); - self.usage = command.usage().to_string(); + self.extra_description = command.extra_description().to_string(); + self.description = command.description().to_string(); self } @@ -627,12 +632,12 @@ impl Command for Predeclaration { self.signature.clone() } - fn usage(&self) -> &str { - &self.signature.usage + fn description(&self) -> &str { + &self.signature.description } - fn extra_usage(&self) -> &str { - &self.signature.extra_usage + fn extra_description(&self) -> &str { + &self.signature.extra_description } fn run( @@ -680,12 +685,12 @@ impl Command for BlockCommand { self.signature.clone() } - fn usage(&self) -> &str { - &self.signature.usage + fn description(&self) -> &str { + &self.signature.description } - fn extra_usage(&self) -> &str { - &self.signature.extra_usage + fn extra_description(&self) -> &str { + &self.signature.extra_description } fn run( diff --git a/crates/nu-protocol/tests/test_signature.rs b/crates/nu-protocol/tests/test_signature.rs index 8faf772c38..011607959a 100644 --- a/crates/nu-protocol/tests/test_signature.rs +++ b/crates/nu-protocol/tests/test_signature.rs @@ -9,14 +9,14 @@ fn test_signature() { assert_eq!(signature, from_build); // constructing signature with description - let signature = Signature::new("signature").usage("example usage"); - assert_eq!(signature.usage, "example usage".to_string()) + let signature = Signature::new("signature").description("example description"); + assert_eq!(signature.description, "example description".to_string()) } #[test] fn test_signature_chained() { let signature = Signature::new("new_signature") - .usage("description") + .description("description") .required("required", SyntaxShape::String, "required description") .optional("optional", SyntaxShape::String, "optional description") .required_named( @@ -126,7 +126,7 @@ fn test_signature_same_name() { #[test] fn test_signature_round_trip() { let signature = Signature::new("new_signature") - .usage("description") + .description("description") .required("first", SyntaxShape::String, "first required") .required("second", SyntaxShape::Int, "second required") .optional("optional", SyntaxShape::String, "optional description") @@ -145,8 +145,8 @@ fn test_signature_round_trip() { let returned: Signature = serde_json::from_str(&string).unwrap(); assert_eq!(signature.name, returned.name); - assert_eq!(signature.usage, returned.usage); - assert_eq!(signature.extra_usage, returned.extra_usage); + assert_eq!(signature.description, returned.description); + assert_eq!(signature.extra_description, returned.extra_description); assert_eq!(signature.is_filter, returned.is_filter); assert_eq!(signature.category, returned.category); diff --git a/crates/nu-std/README.md b/crates/nu-std/README.md index 23bd684a50..42cdf1569a 100644 --- a/crates/nu-std/README.md +++ b/crates/nu-std/README.md @@ -9,8 +9,8 @@ provide interactive utilities and building blocks for users writing casual scrip To see what's here: ```text > use std -> scope commands | select name usage | where name =~ "std " -#┬───────────name────────────┬──────────────────────usage────────────────────── +> scope commands | select name description | where name =~ "std " +#┬───────────name────────────┬───────────────────description─────────────────── 0│std assert │Universal assert command 1│std assert equal │Assert $left == $right 2│std assert error │Assert that executing the code generates an error diff --git a/crates/nu-std/std/help.nu b/crates/nu-std/std/help.nu index 16a20504cb..d608ae8bcb 100644 --- a/crates/nu-std/std/help.nu +++ b/crates/nu-std/std/help.nu @@ -73,11 +73,11 @@ def get-all-operators [] { return [ ]} def "nu-complete list-aliases" [] { - scope aliases | select name usage | rename value description + scope aliases | select name description | rename value description } def "nu-complete list-modules" [] { - scope modules | select name usage | rename value description + scope modules | select name description | rename value description } def "nu-complete list-operators" [] { @@ -90,7 +90,7 @@ def "nu-complete list-operators" [] { } def "nu-complete list-commands" [] { - scope commands | select name usage | rename value description + scope commands | select name description | rename value description } def "nu-complete main-help" [] { @@ -106,7 +106,7 @@ def "nu-complete main-help" [] { } def "nu-complete list-externs" [] { - scope commands | where is_extern | select name usage | rename value description + scope commands | where is_extern | select name description | rename value description } def build-help-header [ @@ -123,8 +123,8 @@ def build-help-header [ } def build-module-page [module: record] { - let usage = (if not ($module.usage? | is-empty) {[ - $module.usage + let description = (if not ($module.description? | is-empty) {[ + $module.description "" ]} else { [] }) @@ -157,7 +157,7 @@ def build-module-page [module: record] { (view source $module.env_block) ]}) - [$usage $name $commands $aliases $env_block] | flatten | str join "\n" + [$description $name $commands $aliases $env_block] | flatten | str join "\n" } # Show help on nushell modules. @@ -203,7 +203,7 @@ def build-module-page [module: record] { # show all aliases # > help modules # ╭───┬──────┬──────────┬────────────────┬──────────────┬───────────────╮ -# │ # │ name │ commands │ aliases │ env_block │ usage │ +# │ # │ name │ commands │ aliases │ env_block │ description │ # ├───┼──────┼──────────┼────────────────┼──────────────┼───────────────┤ # │ 0 │ bar │ [baz] │ [list 0 items] │ │ my bar module │ # │ 1 │ baz │ [bar] │ [list 0 items] │ │ my baz module │ @@ -213,7 +213,7 @@ def build-module-page [module: record] { # search for string in module names # > help modules --find ba # ╭───┬──────┬─────────────┬────────────────┬──────────────┬───────────────╮ -# │ # │ name │ commands │ aliases │ env_block │ usage │ +# │ # │ name │ commands │ aliases │ env_block │ description │ # ├───┼──────┼─────────────┼────────────────┼──────────────┼───────────────┤ # │ 0 │ bar │ ╭───┬─────╮ │ [list 0 items] │ │ my bar module │ # │ │ │ │ 0 │ baz │ │ │ │ │ @@ -253,7 +253,7 @@ export def modules [ let modules = (scope modules) if not ($find | is-empty) { - $modules | find $find --columns [name usage] + $modules | find $find --columns [name description] } else if not ($module | is-empty) { let found_module = ($modules | where name == ($module | str join " ")) @@ -268,8 +268,8 @@ export def modules [ } def build-alias-page [alias: record] { - let usage = (if not ($alias.usage? | is-empty) {[ - $alias.usage + let description = (if not ($alias.description? | is-empty) {[ + $alias.description "" ]} else { [] }) @@ -281,7 +281,7 @@ def build-alias-page [alias: record] { $" ($alias.expansion)" ] - [$usage $rest] | flatten | str join "\n" + [$description $rest] | flatten | str join "\n" } # Show help on nushell aliases. @@ -309,7 +309,7 @@ def build-alias-page [alias: record] { # show all aliases # > help aliases # ╭───┬───────┬────────────────────┬───────────────────╮ -# │ # │ name │ expansion │ usage │ +# │ # │ name │ expansion │ description │ # ├───┼───────┼────────────────────┼───────────────────┤ # │ 0 │ bar │ echo "this is bar" │ my bar alias │ # │ 1 │ baz │ echo "this is baz" │ my baz alias │ @@ -324,7 +324,7 @@ def build-alias-page [alias: record] { # search for string in alias names # > help aliases --find ba # ╭───┬──────┬────────────────────┬──────────────╮ -# │ # │ name │ expansion │ usage │ +# │ # │ name │ expansion │ description │ # ├───┼──────┼────────────────────┼──────────────┤ # │ 0 │ bar │ echo "this is bar" │ my bar alias │ # │ 1 │ baz │ echo "this is baz" │ my baz alias │ @@ -359,7 +359,7 @@ export def aliases [ let aliases = (scope aliases | sort-by name) if not ($find | is-empty) { - $aliases | find $find --columns [name usage] + $aliases | find $find --columns [name description] } else if not ($alias | is-empty) { let found_alias = ($aliases | where name == ($alias | str join " ")) @@ -374,8 +374,8 @@ export def aliases [ } def build-extern-page [extern: record] { - let usage = (if not ($extern.usage? | is-empty) {[ - $extern.usage + let description = (if not ($extern.description? | is-empty) {[ + $extern.description "" ]} else { [] }) @@ -384,7 +384,7 @@ def build-extern-page [extern: record] { $" ($extern.name)" ] - [$usage $rest] | flatten | str join "\n" + [$description $rest] | flatten | str join "\n" } # Show help on nushell externs. @@ -395,13 +395,13 @@ export def externs [ let externs = ( scope commands | where is_extern - | select name module_name usage + | select name module_name description | sort-by name | str trim ) if not ($find | is-empty) { - $externs | find $find --columns [name usage] + $externs | find $find --columns [name description] } else if not ($extern | is-empty) { let found_extern = ($externs | where name == ($extern | str join " ")) @@ -482,12 +482,12 @@ export def operators [ } def build-command-page [command: record] { - let usage = (if not ($command.usage? | is-empty) {[ - $command.usage + let description = (if not ($command.description? | is-empty) {[ + $command.description ]} else { [] }) - let extra_usage = (if not ($command.extra_usage? | is-empty) {[ + let extra_description = (if not ($command.extra_description? | is-empty) {[ "" - $command.extra_usage + $command.extra_description ]} else { [] }) let search_terms = (if not ($command.search_terms? | is-empty) {[ @@ -568,11 +568,11 @@ def build-command-page [command: record] { ] } else { [] }) - let subcommands = (scope commands | where name =~ $"^($command.name) " | select name usage) + let subcommands = (scope commands | where name =~ $"^($command.name) " | select name description) let subcommands = (if not ($subcommands | is-empty) {[ (build-help-header "Subcommands") ($subcommands | each {|subcommand | - $" (ansi teal)($subcommand.name)(ansi reset) - ($subcommand.usage)" + $" (ansi teal)($subcommand.name)(ansi reset) - ($subcommand.description)" } | str join "\n") ]} else { [] }) @@ -671,8 +671,8 @@ def build-command-page [command: record] { ] | flatten} else { [] }) [ - $usage - $extra_usage + $description + $extra_description $search_terms $module $category @@ -687,13 +687,13 @@ def build-command-page [command: record] { # Show help on commands. export def commands [ ...command: string@"nu-complete list-commands" # the name of command to get help on - --find (-f): string # string to find in command names and usage + --find (-f): string # string to find in command names and description ] { let commands = (scope commands | sort-by name) if not ($find | is-empty) { # TODO: impl find for external commands - $commands | find $find --columns [name usage search_terms] | select name category usage signatures search_terms + $commands | find $find --columns [name description search_terms] | select name category description signatures search_terms } else if not ($command | is-empty) { let target_command = ($command | str join " ") let found_command = ($commands | where name == $target_command) @@ -709,7 +709,7 @@ export def commands [ build-command-page ($found_command | get 0) } else { - $commands | select name category usage signatures search_terms + $commands | select name category description signatures search_terms } } @@ -729,11 +729,11 @@ def pretty-cmd [] { # show help for single sub-command, alias, or module # > help str join # -# search for string in command names, usage and search terms +# search for string in command names, description and search terms # > help --find char export def main [ ...item: string@"nu-complete main-help" # the name of the help item to get help on - --find (-f): string # string to find in help items names and usage + --find (-f): string # string to find in help items names and description ] { if ($item | is-empty) and ($find | is-empty) { print $"Welcome to Nushell. diff --git a/crates/nu_plugin_custom_values/src/drop_check.rs b/crates/nu_plugin_custom_values/src/drop_check.rs index b23090c37d..2881e59ad5 100644 --- a/crates/nu_plugin_custom_values/src/drop_check.rs +++ b/crates/nu_plugin_custom_values/src/drop_check.rs @@ -66,7 +66,7 @@ impl SimplePluginCommand for DropCheck { "custom-value drop-check" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Generates a custom value that prints a message when dropped" } diff --git a/crates/nu_plugin_custom_values/src/generate.rs b/crates/nu_plugin_custom_values/src/generate.rs index b4cc8bd6b1..264208d8ab 100644 --- a/crates/nu_plugin_custom_values/src/generate.rs +++ b/crates/nu_plugin_custom_values/src/generate.rs @@ -11,7 +11,7 @@ impl SimplePluginCommand for Generate { "custom-value generate" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "PluginSignature for a plugin that generates a custom value" } diff --git a/crates/nu_plugin_custom_values/src/generate2.rs b/crates/nu_plugin_custom_values/src/generate2.rs index 806086f4fb..1aa69d2715 100644 --- a/crates/nu_plugin_custom_values/src/generate2.rs +++ b/crates/nu_plugin_custom_values/src/generate2.rs @@ -11,7 +11,7 @@ impl SimplePluginCommand for Generate2 { "custom-value generate2" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "PluginSignature for a plugin that generates a different custom value" } diff --git a/crates/nu_plugin_custom_values/src/handle_get.rs b/crates/nu_plugin_custom_values/src/handle_get.rs index 017ac42477..826248aad3 100644 --- a/crates/nu_plugin_custom_values/src/handle_get.rs +++ b/crates/nu_plugin_custom_values/src/handle_get.rs @@ -17,7 +17,7 @@ impl SimplePluginCommand for HandleGet { .input_output_type(Type::Custom("HandleCustomValue".into()), Type::Any) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Get a value previously stored in a handle" } diff --git a/crates/nu_plugin_custom_values/src/handle_make.rs b/crates/nu_plugin_custom_values/src/handle_make.rs index afc3e914a2..e485ad3ced 100644 --- a/crates/nu_plugin_custom_values/src/handle_make.rs +++ b/crates/nu_plugin_custom_values/src/handle_make.rs @@ -19,7 +19,7 @@ impl SimplePluginCommand for HandleMake { .input_output_type(Type::Any, Type::Custom("HandleCustomValue".into())) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Store a value in plugin memory and return a handle to it" } diff --git a/crates/nu_plugin_custom_values/src/handle_update.rs b/crates/nu_plugin_custom_values/src/handle_update.rs index 8256464ca7..230522732a 100644 --- a/crates/nu_plugin_custom_values/src/handle_update.rs +++ b/crates/nu_plugin_custom_values/src/handle_update.rs @@ -29,7 +29,7 @@ impl SimplePluginCommand for HandleUpdate { ) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Update the value in a handle and return a new handle with the result" } diff --git a/crates/nu_plugin_custom_values/src/update.rs b/crates/nu_plugin_custom_values/src/update.rs index 0ce7c09ec9..41d9c9a6f7 100644 --- a/crates/nu_plugin_custom_values/src/update.rs +++ b/crates/nu_plugin_custom_values/src/update.rs @@ -13,7 +13,7 @@ impl SimplePluginCommand for Update { "custom-value update" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "PluginSignature for a plugin that updates a custom value" } diff --git a/crates/nu_plugin_custom_values/src/update_arg.rs b/crates/nu_plugin_custom_values/src/update_arg.rs index adbe64773c..bac07e150a 100644 --- a/crates/nu_plugin_custom_values/src/update_arg.rs +++ b/crates/nu_plugin_custom_values/src/update_arg.rs @@ -11,7 +11,7 @@ impl SimplePluginCommand for UpdateArg { "custom-value update-arg" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Updates a custom value as an argument" } diff --git a/crates/nu_plugin_example/src/commands/call_decl.rs b/crates/nu_plugin_example/src/commands/call_decl.rs index d8c8206d90..7ced94218e 100644 --- a/crates/nu_plugin_example/src/commands/call_decl.rs +++ b/crates/nu_plugin_example/src/commands/call_decl.rs @@ -33,11 +33,11 @@ impl PluginCommand for CallDecl { ) } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Demonstrates calling other commands from plugins using `call_decl()`." } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { " The arguments will not be typechecked at parse time. This command is for demonstration only, and should not be used for anything real. diff --git a/crates/nu_plugin_example/src/commands/collect_bytes.rs b/crates/nu_plugin_example/src/commands/collect_bytes.rs index e716493785..16cb205571 100644 --- a/crates/nu_plugin_example/src/commands/collect_bytes.rs +++ b/crates/nu_plugin_example/src/commands/collect_bytes.rs @@ -16,7 +16,7 @@ impl PluginCommand for CollectBytes { "example collect-bytes" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Example transformer to byte stream" } diff --git a/crates/nu_plugin_example/src/commands/config.rs b/crates/nu_plugin_example/src/commands/config.rs index 7716e27537..ff625f5e59 100644 --- a/crates/nu_plugin_example/src/commands/config.rs +++ b/crates/nu_plugin_example/src/commands/config.rs @@ -39,11 +39,11 @@ impl SimplePluginCommand for Config { "example config" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Show plugin configuration" } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "The configuration is set under $env.config.plugins.example" } diff --git a/crates/nu_plugin_example/src/commands/ctrlc.rs b/crates/nu_plugin_example/src/commands/ctrlc.rs index 50da9d24da..4170853d57 100644 --- a/crates/nu_plugin_example/src/commands/ctrlc.rs +++ b/crates/nu_plugin_example/src/commands/ctrlc.rs @@ -15,7 +15,7 @@ impl PluginCommand for Ctrlc { "example ctrlc" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Example command that demonstrates registering an interrupt signal handler" } diff --git a/crates/nu_plugin_example/src/commands/disable_gc.rs b/crates/nu_plugin_example/src/commands/disable_gc.rs index 5ff7f508e0..68263fc084 100644 --- a/crates/nu_plugin_example/src/commands/disable_gc.rs +++ b/crates/nu_plugin_example/src/commands/disable_gc.rs @@ -12,11 +12,11 @@ impl SimplePluginCommand for DisableGc { "example disable-gc" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Disable the plugin garbage collector for `example`" } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "\ Plugins are garbage collected by default after a period of inactivity. This behavior is configurable with `$env.config.plugin_gc.default`, or to change it diff --git a/crates/nu_plugin_example/src/commands/echo.rs b/crates/nu_plugin_example/src/commands/echo.rs index e60ccf8107..47578c2401 100644 --- a/crates/nu_plugin_example/src/commands/echo.rs +++ b/crates/nu_plugin_example/src/commands/echo.rs @@ -13,7 +13,7 @@ impl PluginCommand for Echo { "example echo" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Example stream consumer that outputs the received input" } diff --git a/crates/nu_plugin_example/src/commands/env.rs b/crates/nu_plugin_example/src/commands/env.rs index 66d37e84fa..a854762999 100644 --- a/crates/nu_plugin_example/src/commands/env.rs +++ b/crates/nu_plugin_example/src/commands/env.rs @@ -12,11 +12,11 @@ impl SimplePluginCommand for Env { "example env" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Get environment variable(s)" } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "Returns all environment variables if no name provided" } diff --git a/crates/nu_plugin_example/src/commands/for_each.rs b/crates/nu_plugin_example/src/commands/for_each.rs index b784deb88c..e66a3841dc 100644 --- a/crates/nu_plugin_example/src/commands/for_each.rs +++ b/crates/nu_plugin_example/src/commands/for_each.rs @@ -13,11 +13,11 @@ impl PluginCommand for ForEach { "example for-each" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Example execution of a closure with a stream" } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "Prints each value the closure returns to stderr" } diff --git a/crates/nu_plugin_example/src/commands/generate.rs b/crates/nu_plugin_example/src/commands/generate.rs index c039cc23d5..de63849aef 100644 --- a/crates/nu_plugin_example/src/commands/generate.rs +++ b/crates/nu_plugin_example/src/commands/generate.rs @@ -16,11 +16,11 @@ impl PluginCommand for Generate { "example generate" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Example execution of a closure to produce a stream" } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "See the builtin `generate` command" } diff --git a/crates/nu_plugin_example/src/commands/main.rs b/crates/nu_plugin_example/src/commands/main.rs index adc8000aeb..c670cd4258 100644 --- a/crates/nu_plugin_example/src/commands/main.rs +++ b/crates/nu_plugin_example/src/commands/main.rs @@ -12,11 +12,11 @@ impl SimplePluginCommand for Main { "example" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Example commands for Nushell plugins" } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#" The `example` plugin demonstrates usage of the Nushell plugin API. diff --git a/crates/nu_plugin_example/src/commands/one.rs b/crates/nu_plugin_example/src/commands/one.rs index e0824e3fcf..d99276d6a3 100644 --- a/crates/nu_plugin_example/src/commands/one.rs +++ b/crates/nu_plugin_example/src/commands/one.rs @@ -12,12 +12,12 @@ impl SimplePluginCommand for One { "example one" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Plugin test example 1. Returns Value::Nothing" } - fn extra_usage(&self) -> &str { - "Extra usage for example one" + fn extra_description(&self) -> &str { + "Extra description for example one" } fn signature(&self) -> Signature { diff --git a/crates/nu_plugin_example/src/commands/seq.rs b/crates/nu_plugin_example/src/commands/seq.rs index 88254394c1..902a6115da 100644 --- a/crates/nu_plugin_example/src/commands/seq.rs +++ b/crates/nu_plugin_example/src/commands/seq.rs @@ -16,7 +16,7 @@ impl PluginCommand for Seq { "example seq" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Example stream generator for a list of values" } diff --git a/crates/nu_plugin_example/src/commands/sum.rs b/crates/nu_plugin_example/src/commands/sum.rs index 6f748d426a..e58f27420c 100644 --- a/crates/nu_plugin_example/src/commands/sum.rs +++ b/crates/nu_plugin_example/src/commands/sum.rs @@ -13,7 +13,7 @@ impl PluginCommand for Sum { "example sum" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Example stream consumer for a list of values" } diff --git a/crates/nu_plugin_example/src/commands/three.rs b/crates/nu_plugin_example/src/commands/three.rs index c8e8554937..ff77a2215d 100644 --- a/crates/nu_plugin_example/src/commands/three.rs +++ b/crates/nu_plugin_example/src/commands/three.rs @@ -12,7 +12,7 @@ impl SimplePluginCommand for Three { "example three" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Plugin test example 3. Returns labeled error" } diff --git a/crates/nu_plugin_example/src/commands/two.rs b/crates/nu_plugin_example/src/commands/two.rs index e02465e8b7..f3f4df3240 100644 --- a/crates/nu_plugin_example/src/commands/two.rs +++ b/crates/nu_plugin_example/src/commands/two.rs @@ -12,7 +12,7 @@ impl SimplePluginCommand for Two { "example two" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Plugin test example 2. Returns list of records" } diff --git a/crates/nu_plugin_example/src/commands/view_span.rs b/crates/nu_plugin_example/src/commands/view_span.rs index 95f7cd1166..fb5e05d958 100644 --- a/crates/nu_plugin_example/src/commands/view_span.rs +++ b/crates/nu_plugin_example/src/commands/view_span.rs @@ -13,11 +13,11 @@ impl SimplePluginCommand for ViewSpan { "example view span" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Example command for looking up the contents of a parser span" } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "Shows the original source code of the expression that generated the value passed as input." } diff --git a/crates/nu_plugin_formats/src/from/eml.rs b/crates/nu_plugin_formats/src/from/eml.rs index 2b4c33a814..5d6324e1eb 100644 --- a/crates/nu_plugin_formats/src/from/eml.rs +++ b/crates/nu_plugin_formats/src/from/eml.rs @@ -18,7 +18,7 @@ impl SimplePluginCommand for FromEml { "from eml" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Parse text as .eml and create record." } diff --git a/crates/nu_plugin_formats/src/from/ics.rs b/crates/nu_plugin_formats/src/from/ics.rs index bcd7311f8a..482807ba29 100644 --- a/crates/nu_plugin_formats/src/from/ics.rs +++ b/crates/nu_plugin_formats/src/from/ics.rs @@ -17,7 +17,7 @@ impl SimplePluginCommand for FromIcs { "from ics" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Parse text as .ics and create table." } diff --git a/crates/nu_plugin_formats/src/from/ini.rs b/crates/nu_plugin_formats/src/from/ini.rs index bb44ce1398..ec1168f6f6 100644 --- a/crates/nu_plugin_formats/src/from/ini.rs +++ b/crates/nu_plugin_formats/src/from/ini.rs @@ -14,7 +14,7 @@ impl SimplePluginCommand for FromIni { "from ini" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Parse text as .ini and create table." } diff --git a/crates/nu_plugin_formats/src/from/plist.rs b/crates/nu_plugin_formats/src/from/plist.rs index c98b6ea58d..113714e4c4 100644 --- a/crates/nu_plugin_formats/src/from/plist.rs +++ b/crates/nu_plugin_formats/src/from/plist.rs @@ -18,7 +18,7 @@ impl SimplePluginCommand for FromPlist { "from plist" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert plist to Nushell values" } diff --git a/crates/nu_plugin_formats/src/from/vcf.rs b/crates/nu_plugin_formats/src/from/vcf.rs index a751a774d3..9bf99e02af 100644 --- a/crates/nu_plugin_formats/src/from/vcf.rs +++ b/crates/nu_plugin_formats/src/from/vcf.rs @@ -16,7 +16,7 @@ impl SimplePluginCommand for FromVcf { "from vcf" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Parse text as .vcf and create table." } diff --git a/crates/nu_plugin_formats/src/to/plist.rs b/crates/nu_plugin_formats/src/to/plist.rs index 94368c184a..caf039263e 100644 --- a/crates/nu_plugin_formats/src/to/plist.rs +++ b/crates/nu_plugin_formats/src/to/plist.rs @@ -15,7 +15,7 @@ impl SimplePluginCommand for IntoPlist { "to plist" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Convert Nu values into plist" } diff --git a/crates/nu_plugin_gstat/src/gstat.rs b/crates/nu_plugin_gstat/src/gstat.rs index 849531683d..5c1ab0e248 100644 --- a/crates/nu_plugin_gstat/src/gstat.rs +++ b/crates/nu_plugin_gstat/src/gstat.rs @@ -16,10 +16,6 @@ impl GStat { Default::default() } - pub fn usage() -> &'static str { - "Usage: gstat" - } - pub fn gstat( &self, value: &Value, diff --git a/crates/nu_plugin_gstat/src/nu/mod.rs b/crates/nu_plugin_gstat/src/nu/mod.rs index f44894085d..e89112c878 100644 --- a/crates/nu_plugin_gstat/src/nu/mod.rs +++ b/crates/nu_plugin_gstat/src/nu/mod.rs @@ -21,7 +21,7 @@ impl SimplePluginCommand for GStat { "gstat" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Get the git status of a repo" } diff --git a/crates/nu_plugin_inc/src/inc.rs b/crates/nu_plugin_inc/src/inc.rs index 6510cbd6a6..acc74635ed 100644 --- a/crates/nu_plugin_inc/src/inc.rs +++ b/crates/nu_plugin_inc/src/inc.rs @@ -89,10 +89,6 @@ impl Inc { self.error = Some(message.to_string()); } - pub fn usage() -> &'static str { - "Usage: inc field [--major|--minor|--patch]" - } - pub fn inc(&self, head: Span, value: &Value) -> Result { if let Some(cell_path) = &self.cell_path { let working_value = value.clone(); diff --git a/crates/nu_plugin_inc/src/nu/mod.rs b/crates/nu_plugin_inc/src/nu/mod.rs index b7d9c8960f..82a5fa978e 100644 --- a/crates/nu_plugin_inc/src/nu/mod.rs +++ b/crates/nu_plugin_inc/src/nu/mod.rs @@ -21,7 +21,7 @@ impl SimplePluginCommand for Inc { "inc" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Increment a value or version. Optionally use the column of a table." } diff --git a/crates/nu_plugin_nu_example/nu_plugin_nu_example.nu b/crates/nu_plugin_nu_example/nu_plugin_nu_example.nu index 51e2ef1ac8..09f4769311 100755 --- a/crates/nu_plugin_nu_example/nu_plugin_nu_example.nu +++ b/crates/nu_plugin_nu_example/nu_plugin_nu_example.nu @@ -22,8 +22,8 @@ const SIGNATURES = [ { sig: { name: nu_plugin_nu_example, - usage: "Signature test for Nushell plugin in Nushell", - extra_usage: "", + description: "Signature test for Nushell plugin in Nushell", + extra_description: "", required_positional: [ [ name, diff --git a/crates/nu_plugin_polars/src/cache/get.rs b/crates/nu_plugin_polars/src/cache/get.rs index 11ade261b9..843e21305a 100644 --- a/crates/nu_plugin_polars/src/cache/get.rs +++ b/crates/nu_plugin_polars/src/cache/get.rs @@ -21,7 +21,7 @@ impl PluginCommand for CacheGet { "polars store-get" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Gets a Dataframe or other object from the plugin cache." } diff --git a/crates/nu_plugin_polars/src/cache/list.rs b/crates/nu_plugin_polars/src/cache/list.rs index 88fc1769ba..c68f910a81 100644 --- a/crates/nu_plugin_polars/src/cache/list.rs +++ b/crates/nu_plugin_polars/src/cache/list.rs @@ -15,7 +15,7 @@ impl PluginCommand for ListDF { "polars store-ls" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Lists stored polars objects." } diff --git a/crates/nu_plugin_polars/src/cache/rm.rs b/crates/nu_plugin_polars/src/cache/rm.rs index 9113f39cec..537b7c6356 100644 --- a/crates/nu_plugin_polars/src/cache/rm.rs +++ b/crates/nu_plugin_polars/src/cache/rm.rs @@ -17,7 +17,7 @@ impl PluginCommand for CacheRemove { "polars store-rm" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Removes a stored Dataframe or other object from the plugin cache." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/append.rs b/crates/nu_plugin_polars/src/dataframe/eager/append.rs index 48c435baa3..fd32a30ca3 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/append.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/append.rs @@ -40,7 +40,7 @@ impl PluginCommand for AppendDF { "polars append" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Appends a new dataframe." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/cast.rs b/crates/nu_plugin_polars/src/dataframe/eager/cast.rs index d676fb04ea..5787d961e1 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/cast.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/cast.rs @@ -22,7 +22,7 @@ impl PluginCommand for CastDF { "polars cast" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Cast a column to a different dtype." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/columns.rs b/crates/nu_plugin_polars/src/dataframe/eager/columns.rs index 892d3a5175..5fa4fb82a8 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/columns.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/columns.rs @@ -16,7 +16,7 @@ impl PluginCommand for ColumnsDF { "polars columns" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Show dataframe columns." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/drop.rs b/crates/nu_plugin_polars/src/dataframe/eager/drop.rs index 812a77b048..4e2a2b7136 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/drop.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/drop.rs @@ -20,7 +20,7 @@ impl PluginCommand for DropDF { "polars drop" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates a new dataframe by dropping the selected columns." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/drop_duplicates.rs b/crates/nu_plugin_polars/src/dataframe/eager/drop_duplicates.rs index 3eb6311637..2d311867ea 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/drop_duplicates.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/drop_duplicates.rs @@ -21,7 +21,7 @@ impl PluginCommand for DropDuplicates { "polars drop-duplicates" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Drops duplicate values in dataframe." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/drop_nulls.rs b/crates/nu_plugin_polars/src/dataframe/eager/drop_nulls.rs index 4d1b41e2fa..43dbf29f3d 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/drop_nulls.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/drop_nulls.rs @@ -20,7 +20,7 @@ impl PluginCommand for DropNulls { "polars drop-nulls" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Drops null values in dataframe." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/dummies.rs b/crates/nu_plugin_polars/src/dataframe/eager/dummies.rs index 0f02085ec2..6346ebfb60 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/dummies.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/dummies.rs @@ -16,7 +16,7 @@ impl PluginCommand for Dummies { "polars dummies" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates a new dataframe with dummy variables." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/filter_with.rs b/crates/nu_plugin_polars/src/dataframe/eager/filter_with.rs index b95f646edd..acfe2251cd 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/filter_with.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/filter_with.rs @@ -23,7 +23,7 @@ impl PluginCommand for FilterWith { "polars filter-with" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Filters dataframe using a mask or expression as reference." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/first.rs b/crates/nu_plugin_polars/src/dataframe/eager/first.rs index b874c257cb..e75aa04428 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/first.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/first.rs @@ -20,7 +20,7 @@ impl PluginCommand for FirstDF { "polars first" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Show only the first number of rows or create a first expression" } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/get.rs b/crates/nu_plugin_polars/src/dataframe/eager/get.rs index 34ba98154f..330b027b0d 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/get.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/get.rs @@ -20,7 +20,7 @@ impl PluginCommand for GetDF { "polars get" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates dataframe with the selected columns." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/last.rs b/crates/nu_plugin_polars/src/dataframe/eager/last.rs index 316d346085..88f1041c25 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/last.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/last.rs @@ -20,7 +20,7 @@ impl PluginCommand for LastDF { "polars last" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates new dataframe with tail rows or creates a last expression." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/open.rs b/crates/nu_plugin_polars/src/dataframe/eager/open.rs index 77fbe583aa..c2894d64fe 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/open.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/open.rs @@ -45,7 +45,7 @@ impl PluginCommand for OpenDataFrame { "polars open" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Opens CSV, JSON, NDJSON/JSON lines, arrow, avro, or parquet file to create dataframe. A lazy dataframe will be created by default, if supported." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/pivot.rs b/crates/nu_plugin_polars/src/dataframe/eager/pivot.rs index b72210d011..c541d16520 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/pivot.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/pivot.rs @@ -24,7 +24,7 @@ impl PluginCommand for PivotDF { "polars pivot" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Pivot a DataFrame from wide to long format." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/query_df.rs b/crates/nu_plugin_polars/src/dataframe/eager/query_df.rs index a09da57250..799a3b4d64 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/query_df.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/query_df.rs @@ -24,7 +24,7 @@ impl PluginCommand for QueryDf { "polars query" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Query dataframe using SQL. Note: The dataframe is always named 'df' in your query's from clause." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/rename.rs b/crates/nu_plugin_polars/src/dataframe/eager/rename.rs index 724cf1f983..197d347b97 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/rename.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/rename.rs @@ -22,7 +22,7 @@ impl PluginCommand for RenameDF { "polars rename" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Rename a dataframe column." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/sample.rs b/crates/nu_plugin_polars/src/dataframe/eager/sample.rs index 59f9ad6eee..8e110feef9 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/sample.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/sample.rs @@ -20,7 +20,7 @@ impl PluginCommand for SampleDF { "polars sample" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Create sample dataframe." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/save/mod.rs b/crates/nu_plugin_polars/src/dataframe/eager/save/mod.rs index ce49fc54da..0c15f5abbc 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/save/mod.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/save/mod.rs @@ -29,7 +29,7 @@ impl PluginCommand for SaveDF { "polars save" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Saves a dataframe to disk. For lazy dataframes a sink operation will be used if the file type supports it (parquet, ipc/arrow, csv, and ndjson)." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/schema.rs b/crates/nu_plugin_polars/src/dataframe/eager/schema.rs index e1350289a7..01451ff443 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/schema.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/schema.rs @@ -15,7 +15,7 @@ impl PluginCommand for SchemaCmd { "polars schema" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Show schema for a dataframe." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/shape.rs b/crates/nu_plugin_polars/src/dataframe/eager/shape.rs index ba1e99ebfe..60f96e8b9f 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/shape.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/shape.rs @@ -17,7 +17,7 @@ impl PluginCommand for ShapeDF { "polars shape" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Shows column and row size for a dataframe." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/slice.rs b/crates/nu_plugin_polars/src/dataframe/eager/slice.rs index c7ebaff4d7..feeeab5df0 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/slice.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/slice.rs @@ -18,7 +18,7 @@ impl PluginCommand for SliceDF { "polars slice" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates new dataframe from a slice of rows." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/summary.rs b/crates/nu_plugin_polars/src/dataframe/eager/summary.rs index 74e96fc7be..863fb891b7 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/summary.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/summary.rs @@ -25,7 +25,7 @@ impl PluginCommand for Summary { "polars summary" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "For a dataframe, produces descriptive statistics (summary statistics) for its numeric columns." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/take.rs b/crates/nu_plugin_polars/src/dataframe/eager/take.rs index 28b22095a1..a03093b607 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/take.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/take.rs @@ -19,7 +19,7 @@ impl PluginCommand for TakeDF { "polars take" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates new dataframe using the given indices." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/to_df.rs b/crates/nu_plugin_polars/src/dataframe/eager/to_df.rs index 0747f16613..39d54f6e10 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/to_df.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/to_df.rs @@ -25,7 +25,7 @@ impl PluginCommand for ToDataFrame { "polars into-df" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Converts a list, table or record into a dataframe." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/to_nu.rs b/crates/nu_plugin_polars/src/dataframe/eager/to_nu.rs index 0647b8d4e3..a8b4aa3976 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/to_nu.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/to_nu.rs @@ -22,7 +22,7 @@ impl PluginCommand for ToNu { "polars into-nu" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Converts a dataframe or an expression into nushell value for access and exploration." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/unpivot.rs b/crates/nu_plugin_polars/src/dataframe/eager/unpivot.rs index dafdc65ab4..0d61951ec2 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/unpivot.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/unpivot.rs @@ -23,7 +23,7 @@ impl PluginCommand for UnpivotDF { "polars unpivot" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Unpivot a DataFrame from wide to long format." } diff --git a/crates/nu_plugin_polars/src/dataframe/eager/with_column.rs b/crates/nu_plugin_polars/src/dataframe/eager/with_column.rs index 5db11766b9..1c29f90c3f 100644 --- a/crates/nu_plugin_polars/src/dataframe/eager/with_column.rs +++ b/crates/nu_plugin_polars/src/dataframe/eager/with_column.rs @@ -20,7 +20,7 @@ impl PluginCommand for WithColumn { "polars with-column" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Adds a series to the dataframe." } diff --git a/crates/nu_plugin_polars/src/dataframe/expressions/alias.rs b/crates/nu_plugin_polars/src/dataframe/expressions/alias.rs index c780f13d9f..0c12be144e 100644 --- a/crates/nu_plugin_polars/src/dataframe/expressions/alias.rs +++ b/crates/nu_plugin_polars/src/dataframe/expressions/alias.rs @@ -17,7 +17,7 @@ impl PluginCommand for ExprAlias { "polars as" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates an alias expression." } diff --git a/crates/nu_plugin_polars/src/dataframe/expressions/arg_where.rs b/crates/nu_plugin_polars/src/dataframe/expressions/arg_where.rs index a9d29c3b14..45105a6f75 100644 --- a/crates/nu_plugin_polars/src/dataframe/expressions/arg_where.rs +++ b/crates/nu_plugin_polars/src/dataframe/expressions/arg_where.rs @@ -19,7 +19,7 @@ impl PluginCommand for ExprArgWhere { "polars arg-where" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates an expression that returns the arguments where expression is true." } diff --git a/crates/nu_plugin_polars/src/dataframe/expressions/col.rs b/crates/nu_plugin_polars/src/dataframe/expressions/col.rs index b9f152ebe7..33533e2a90 100644 --- a/crates/nu_plugin_polars/src/dataframe/expressions/col.rs +++ b/crates/nu_plugin_polars/src/dataframe/expressions/col.rs @@ -15,7 +15,7 @@ impl PluginCommand for ExprCol { "polars col" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates a named column expression." } diff --git a/crates/nu_plugin_polars/src/dataframe/expressions/concat_str.rs b/crates/nu_plugin_polars/src/dataframe/expressions/concat_str.rs index 09c64ccdb2..3dd3e4f6ae 100644 --- a/crates/nu_plugin_polars/src/dataframe/expressions/concat_str.rs +++ b/crates/nu_plugin_polars/src/dataframe/expressions/concat_str.rs @@ -19,7 +19,7 @@ impl PluginCommand for ExprConcatStr { "polars concat-str" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates a concat string expression." } diff --git a/crates/nu_plugin_polars/src/dataframe/expressions/datepart.rs b/crates/nu_plugin_polars/src/dataframe/expressions/datepart.rs index 1cbb5fa532..1c7b7e7005 100644 --- a/crates/nu_plugin_polars/src/dataframe/expressions/datepart.rs +++ b/crates/nu_plugin_polars/src/dataframe/expressions/datepart.rs @@ -27,7 +27,7 @@ impl PluginCommand for ExprDatePart { "polars datepart" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates an expression for capturing the specified datepart in a column." } diff --git a/crates/nu_plugin_polars/src/dataframe/expressions/expressions_macro.rs b/crates/nu_plugin_polars/src/dataframe/expressions/expressions_macro.rs index 58b60f3427..2a18c31c4d 100644 --- a/crates/nu_plugin_polars/src/dataframe/expressions/expressions_macro.rs +++ b/crates/nu_plugin_polars/src/dataframe/expressions/expressions_macro.rs @@ -21,13 +21,13 @@ macro_rules! expr_command { $name } - fn usage(&self) -> &str { + fn description(&self) -> &str { $desc } fn signature(&self) -> Signature { Signature::build(self.name()) - .usage($desc) + .description($desc) .input_output_type( Type::Custom("expression".into()), Type::Custom("expression".into()), @@ -76,7 +76,7 @@ macro_rules! expr_command { fn signature(&self) -> Signature { Signature::build(self.name()) - .usage($desc) + .description($desc) .input_output_type( Type::Custom("expression".into()), Type::Custom("expression".into()), @@ -127,13 +127,13 @@ macro_rules! lazy_expr_command { $name } - fn usage(&self) -> &str { + fn description(&self) -> &str { $desc } fn signature(&self) -> Signature { Signature::build(self.name()) - .usage($desc) + .description($desc) .input_output_types(vec![ ( Type::Custom("expression".into()), @@ -199,7 +199,7 @@ macro_rules! lazy_expr_command { $name } - fn usage(&self) -> &str { + fn description(&self) -> &str { $desc } fn signature(&self) -> Signature { diff --git a/crates/nu_plugin_polars/src/dataframe/expressions/is_in.rs b/crates/nu_plugin_polars/src/dataframe/expressions/is_in.rs index 136ac5c1e6..d2359c9d12 100644 --- a/crates/nu_plugin_polars/src/dataframe/expressions/is_in.rs +++ b/crates/nu_plugin_polars/src/dataframe/expressions/is_in.rs @@ -20,7 +20,7 @@ impl PluginCommand for ExprIsIn { "polars is-in" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates an is-in expression or checks to see if the elements are contained in the right series" } diff --git a/crates/nu_plugin_polars/src/dataframe/expressions/lit.rs b/crates/nu_plugin_polars/src/dataframe/expressions/lit.rs index 1238717b2d..241058fb5c 100644 --- a/crates/nu_plugin_polars/src/dataframe/expressions/lit.rs +++ b/crates/nu_plugin_polars/src/dataframe/expressions/lit.rs @@ -14,7 +14,7 @@ impl PluginCommand for ExprLit { "polars lit" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates a literal expression." } diff --git a/crates/nu_plugin_polars/src/dataframe/expressions/otherwise.rs b/crates/nu_plugin_polars/src/dataframe/expressions/otherwise.rs index 73e616f8f8..5524205867 100644 --- a/crates/nu_plugin_polars/src/dataframe/expressions/otherwise.rs +++ b/crates/nu_plugin_polars/src/dataframe/expressions/otherwise.rs @@ -17,7 +17,7 @@ impl PluginCommand for ExprOtherwise { "polars otherwise" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Completes a when expression." } diff --git a/crates/nu_plugin_polars/src/dataframe/expressions/when.rs b/crates/nu_plugin_polars/src/dataframe/expressions/when.rs index 9ed9ffddac..886ee50f3b 100644 --- a/crates/nu_plugin_polars/src/dataframe/expressions/when.rs +++ b/crates/nu_plugin_polars/src/dataframe/expressions/when.rs @@ -19,7 +19,7 @@ impl PluginCommand for ExprWhen { "polars when" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates and modifies a when expression." } diff --git a/crates/nu_plugin_polars/src/dataframe/lazy/aggregate.rs b/crates/nu_plugin_polars/src/dataframe/lazy/aggregate.rs index add72faf88..fdce9ea311 100644 --- a/crates/nu_plugin_polars/src/dataframe/lazy/aggregate.rs +++ b/crates/nu_plugin_polars/src/dataframe/lazy/aggregate.rs @@ -21,7 +21,7 @@ impl PluginCommand for LazyAggregate { "polars agg" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Performs a series of aggregations from a group-by." } diff --git a/crates/nu_plugin_polars/src/dataframe/lazy/collect.rs b/crates/nu_plugin_polars/src/dataframe/lazy/collect.rs index 4a48680c58..3f3a76df11 100644 --- a/crates/nu_plugin_polars/src/dataframe/lazy/collect.rs +++ b/crates/nu_plugin_polars/src/dataframe/lazy/collect.rs @@ -17,7 +17,7 @@ impl PluginCommand for LazyCollect { "polars collect" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Collect lazy dataframe into eager dataframe." } diff --git a/crates/nu_plugin_polars/src/dataframe/lazy/explode.rs b/crates/nu_plugin_polars/src/dataframe/lazy/explode.rs index 787f07fd46..3266640d34 100644 --- a/crates/nu_plugin_polars/src/dataframe/lazy/explode.rs +++ b/crates/nu_plugin_polars/src/dataframe/lazy/explode.rs @@ -18,7 +18,7 @@ impl PluginCommand for LazyExplode { "polars explode" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Explodes a dataframe or creates a explode expression." } diff --git a/crates/nu_plugin_polars/src/dataframe/lazy/fetch.rs b/crates/nu_plugin_polars/src/dataframe/lazy/fetch.rs index eb9663265b..48df365335 100644 --- a/crates/nu_plugin_polars/src/dataframe/lazy/fetch.rs +++ b/crates/nu_plugin_polars/src/dataframe/lazy/fetch.rs @@ -17,7 +17,7 @@ impl PluginCommand for LazyFetch { "polars fetch" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Collects the lazyframe to the selected rows." } diff --git a/crates/nu_plugin_polars/src/dataframe/lazy/fill_nan.rs b/crates/nu_plugin_polars/src/dataframe/lazy/fill_nan.rs index baeb9da01b..dbe0adf5da 100644 --- a/crates/nu_plugin_polars/src/dataframe/lazy/fill_nan.rs +++ b/crates/nu_plugin_polars/src/dataframe/lazy/fill_nan.rs @@ -19,7 +19,7 @@ impl PluginCommand for LazyFillNA { "polars fill-nan" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Replaces NaN values with the given expression." } diff --git a/crates/nu_plugin_polars/src/dataframe/lazy/fill_null.rs b/crates/nu_plugin_polars/src/dataframe/lazy/fill_null.rs index 6f4f13b08e..7f7b5f1862 100644 --- a/crates/nu_plugin_polars/src/dataframe/lazy/fill_null.rs +++ b/crates/nu_plugin_polars/src/dataframe/lazy/fill_null.rs @@ -19,7 +19,7 @@ impl PluginCommand for LazyFillNull { "polars fill-null" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Replaces NULL values with the given expression." } diff --git a/crates/nu_plugin_polars/src/dataframe/lazy/filter.rs b/crates/nu_plugin_polars/src/dataframe/lazy/filter.rs index e7e30fd57d..0c4e9372e2 100644 --- a/crates/nu_plugin_polars/src/dataframe/lazy/filter.rs +++ b/crates/nu_plugin_polars/src/dataframe/lazy/filter.rs @@ -20,7 +20,7 @@ impl PluginCommand for LazyFilter { "polars filter" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Filter dataframe based in expression." } diff --git a/crates/nu_plugin_polars/src/dataframe/lazy/flatten.rs b/crates/nu_plugin_polars/src/dataframe/lazy/flatten.rs index 93402bbe6a..f292a824bb 100644 --- a/crates/nu_plugin_polars/src/dataframe/lazy/flatten.rs +++ b/crates/nu_plugin_polars/src/dataframe/lazy/flatten.rs @@ -21,7 +21,7 @@ impl PluginCommand for LazyFlatten { "polars flatten" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "An alias for polars explode." } diff --git a/crates/nu_plugin_polars/src/dataframe/lazy/groupby.rs b/crates/nu_plugin_polars/src/dataframe/lazy/groupby.rs index b7bd1017a3..060bdcd63a 100644 --- a/crates/nu_plugin_polars/src/dataframe/lazy/groupby.rs +++ b/crates/nu_plugin_polars/src/dataframe/lazy/groupby.rs @@ -20,7 +20,7 @@ impl PluginCommand for ToLazyGroupBy { "polars group-by" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates a group-by object that can be used for other aggregations." } diff --git a/crates/nu_plugin_polars/src/dataframe/lazy/join.rs b/crates/nu_plugin_polars/src/dataframe/lazy/join.rs index 01fb2ac24d..ee18e17567 100644 --- a/crates/nu_plugin_polars/src/dataframe/lazy/join.rs +++ b/crates/nu_plugin_polars/src/dataframe/lazy/join.rs @@ -20,7 +20,7 @@ impl PluginCommand for LazyJoin { "polars join" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Joins a lazy frame with other lazy frame." } diff --git a/crates/nu_plugin_polars/src/dataframe/lazy/macro_commands.rs b/crates/nu_plugin_polars/src/dataframe/lazy/macro_commands.rs index 1727946f6a..eb63f8b9f2 100644 --- a/crates/nu_plugin_polars/src/dataframe/lazy/macro_commands.rs +++ b/crates/nu_plugin_polars/src/dataframe/lazy/macro_commands.rs @@ -19,13 +19,13 @@ macro_rules! lazy_command { $name } - fn usage(&self) -> &str { + fn description(&self) -> &str { $desc } fn signature(&self) -> Signature { Signature::build(self.name()) - .usage($desc) + .description($desc) .input_output_type( Type::Custom("dataframe".into()), Type::Custom("dataframe".into()), @@ -74,7 +74,7 @@ macro_rules! lazy_command { fn signature(&self) -> Signature { Signature::build($name) - .usage($desc) + .description($desc) .input_output_type( Type::Custom("dataframe".into()), Type::Custom("dataframe".into()), @@ -122,7 +122,7 @@ macro_rules! lazy_command { $name } - fn usage(&self) -> &str { + fn description(&self) -> &str { $desc } fn signature(&self) -> Signature { diff --git a/crates/nu_plugin_polars/src/dataframe/lazy/median.rs b/crates/nu_plugin_polars/src/dataframe/lazy/median.rs index 8106218c26..92578da7e0 100644 --- a/crates/nu_plugin_polars/src/dataframe/lazy/median.rs +++ b/crates/nu_plugin_polars/src/dataframe/lazy/median.rs @@ -19,7 +19,7 @@ impl PluginCommand for LazyMedian { "polars median" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Median value from columns in a dataframe or creates expression for an aggregation" } diff --git a/crates/nu_plugin_polars/src/dataframe/lazy/quantile.rs b/crates/nu_plugin_polars/src/dataframe/lazy/quantile.rs index e63fae6610..79804b2937 100644 --- a/crates/nu_plugin_polars/src/dataframe/lazy/quantile.rs +++ b/crates/nu_plugin_polars/src/dataframe/lazy/quantile.rs @@ -22,7 +22,7 @@ impl PluginCommand for LazyQuantile { "polars quantile" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Aggregates the columns to the selected quantile." } diff --git a/crates/nu_plugin_polars/src/dataframe/lazy/select.rs b/crates/nu_plugin_polars/src/dataframe/lazy/select.rs index 03c4306c30..9417427545 100644 --- a/crates/nu_plugin_polars/src/dataframe/lazy/select.rs +++ b/crates/nu_plugin_polars/src/dataframe/lazy/select.rs @@ -18,7 +18,7 @@ impl PluginCommand for LazySelect { "polars select" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Selects columns from lazyframe." } diff --git a/crates/nu_plugin_polars/src/dataframe/lazy/sort_by_expr.rs b/crates/nu_plugin_polars/src/dataframe/lazy/sort_by_expr.rs index 20251a0ea0..952388a2dc 100644 --- a/crates/nu_plugin_polars/src/dataframe/lazy/sort_by_expr.rs +++ b/crates/nu_plugin_polars/src/dataframe/lazy/sort_by_expr.rs @@ -21,7 +21,7 @@ impl PluginCommand for LazySortBy { "polars sort-by" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Sorts a lazy dataframe based on expression(s)." } diff --git a/crates/nu_plugin_polars/src/dataframe/lazy/to_lazy.rs b/crates/nu_plugin_polars/src/dataframe/lazy/to_lazy.rs index df6616e178..8d81bd1a8a 100644 --- a/crates/nu_plugin_polars/src/dataframe/lazy/to_lazy.rs +++ b/crates/nu_plugin_polars/src/dataframe/lazy/to_lazy.rs @@ -15,7 +15,7 @@ impl PluginCommand for ToLazyFrame { "polars into-lazy" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Converts a dataframe into a lazy dataframe." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/all_false.rs b/crates/nu_plugin_polars/src/dataframe/series/all_false.rs index 0c8c9719a5..36e31dfb98 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/all_false.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/all_false.rs @@ -17,7 +17,7 @@ impl PluginCommand for AllFalse { "polars all-false" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns true if all values are false." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/all_true.rs b/crates/nu_plugin_polars/src/dataframe/series/all_true.rs index 74d98d47c1..cf3d7a79fe 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/all_true.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/all_true.rs @@ -17,7 +17,7 @@ impl PluginCommand for AllTrue { "polars all-true" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns true if all values are true." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/arg_max.rs b/crates/nu_plugin_polars/src/dataframe/series/arg_max.rs index 6736731464..e7c67cdc32 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/arg_max.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/arg_max.rs @@ -18,7 +18,7 @@ impl PluginCommand for ArgMax { "polars arg-max" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Return index for max value in series." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/arg_min.rs b/crates/nu_plugin_polars/src/dataframe/series/arg_min.rs index 4fd29393ed..268ba401da 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/arg_min.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/arg_min.rs @@ -18,7 +18,7 @@ impl PluginCommand for ArgMin { "polars arg-min" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Return index for min value in series." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/cumulative.rs b/crates/nu_plugin_polars/src/dataframe/series/cumulative.rs index 7455297b59..da7081128d 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/cumulative.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/cumulative.rs @@ -51,7 +51,7 @@ impl PluginCommand for Cumulative { "polars cumulative" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Cumulative calculation for a series." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/date/as_date.rs b/crates/nu_plugin_polars/src/dataframe/series/date/as_date.rs index 414853d291..e5c12280d1 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/date/as_date.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/date/as_date.rs @@ -18,11 +18,11 @@ impl PluginCommand for AsDate { "polars as-date" } - fn usage(&self) -> &str { + fn description(&self) -> &str { r#"Converts string to date."# } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"Format example: "%Y-%m-%d" => 2021-12-31 "%d-%m-%Y" => 31-12-2021 diff --git a/crates/nu_plugin_polars/src/dataframe/series/date/as_datetime.rs b/crates/nu_plugin_polars/src/dataframe/series/date/as_datetime.rs index 8e01fda6ac..05f28c00af 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/date/as_datetime.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/date/as_datetime.rs @@ -20,11 +20,11 @@ impl PluginCommand for AsDateTime { "polars as-datetime" } - fn usage(&self) -> &str { + fn description(&self) -> &str { r#"Converts string to datetime."# } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { r#"Format example: "%y/%m/%d %H:%M:%S" => 21/12/31 12:54:98 "%y-%m-%d %H:%M:%S" => 2021-12-31 24:58:01 diff --git a/crates/nu_plugin_polars/src/dataframe/series/date/get_day.rs b/crates/nu_plugin_polars/src/dataframe/series/date/get_day.rs index ea26f4999c..014b345aa2 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/date/get_day.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/date/get_day.rs @@ -21,7 +21,7 @@ impl PluginCommand for GetDay { "polars get-day" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Gets day from date." } @@ -58,7 +58,7 @@ impl PluginCommand for GetDay { command(plugin, engine, call, input).map_err(LabeledError::from) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "" } diff --git a/crates/nu_plugin_polars/src/dataframe/series/date/get_hour.rs b/crates/nu_plugin_polars/src/dataframe/series/date/get_hour.rs index d8f6e2e1c1..0ff5c2d0b7 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/date/get_hour.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/date/get_hour.rs @@ -21,7 +21,7 @@ impl PluginCommand for GetHour { "polars get-hour" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Gets hour from date." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/date/get_minute.rs b/crates/nu_plugin_polars/src/dataframe/series/date/get_minute.rs index bb2f0abc19..a1505bf25b 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/date/get_minute.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/date/get_minute.rs @@ -19,7 +19,7 @@ impl PluginCommand for GetMinute { "polars get-minute" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Gets minute from date." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/date/get_month.rs b/crates/nu_plugin_polars/src/dataframe/series/date/get_month.rs index 141665d371..5ce06aee68 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/date/get_month.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/date/get_month.rs @@ -21,7 +21,7 @@ impl PluginCommand for GetMonth { "polars get-month" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Gets month from date." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/date/get_nanosecond.rs b/crates/nu_plugin_polars/src/dataframe/series/date/get_nanosecond.rs index a94f82add5..e5431dd7c7 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/date/get_nanosecond.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/date/get_nanosecond.rs @@ -21,7 +21,7 @@ impl PluginCommand for GetNanosecond { "polars get-nanosecond" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Gets nanosecond from date." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/date/get_ordinal.rs b/crates/nu_plugin_polars/src/dataframe/series/date/get_ordinal.rs index 7f074df8d9..8120751466 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/date/get_ordinal.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/date/get_ordinal.rs @@ -21,7 +21,7 @@ impl PluginCommand for GetOrdinal { "polars get-ordinal" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Gets ordinal from date." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/date/get_second.rs b/crates/nu_plugin_polars/src/dataframe/series/date/get_second.rs index bf11804443..4764bd1968 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/date/get_second.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/date/get_second.rs @@ -21,7 +21,7 @@ impl PluginCommand for GetSecond { "polars get-second" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Gets second from date." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/date/get_week.rs b/crates/nu_plugin_polars/src/dataframe/series/date/get_week.rs index c3b5724bc4..4418a51f3a 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/date/get_week.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/date/get_week.rs @@ -21,7 +21,7 @@ impl PluginCommand for GetWeek { "polars get-week" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Gets week from date." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/date/get_weekday.rs b/crates/nu_plugin_polars/src/dataframe/series/date/get_weekday.rs index e495370718..6863f161f7 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/date/get_weekday.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/date/get_weekday.rs @@ -21,7 +21,7 @@ impl PluginCommand for GetWeekDay { "polars get-weekday" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Gets weekday from date." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/date/get_year.rs b/crates/nu_plugin_polars/src/dataframe/series/date/get_year.rs index 380cd6367d..70c516a03b 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/date/get_year.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/date/get_year.rs @@ -21,7 +21,7 @@ impl PluginCommand for GetYear { "polars get-year" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Gets year from date." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/indexes/arg_sort.rs b/crates/nu_plugin_polars/src/dataframe/series/indexes/arg_sort.rs index 17f2e4477a..06359f4354 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/indexes/arg_sort.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/indexes/arg_sort.rs @@ -18,7 +18,7 @@ impl PluginCommand for ArgSort { "polars arg-sort" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns indexes for a sorted series." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/indexes/arg_true.rs b/crates/nu_plugin_polars/src/dataframe/series/indexes/arg_true.rs index ae0ec101ca..0cb8f75c03 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/indexes/arg_true.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/indexes/arg_true.rs @@ -18,7 +18,7 @@ impl PluginCommand for ArgTrue { "polars arg-true" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns indexes where values are true." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/indexes/arg_unique.rs b/crates/nu_plugin_polars/src/dataframe/series/indexes/arg_unique.rs index 542d9ed0b1..ef2946bfab 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/indexes/arg_unique.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/indexes/arg_unique.rs @@ -18,7 +18,7 @@ impl PluginCommand for ArgUnique { "polars arg-unique" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns indexes for unique values." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/indexes/set_with_idx.rs b/crates/nu_plugin_polars/src/dataframe/series/indexes/set_with_idx.rs index 436ba92f96..52a8894556 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/indexes/set_with_idx.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/indexes/set_with_idx.rs @@ -22,7 +22,7 @@ impl PluginCommand for SetWithIndex { "polars set-with-idx" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Sets value in the given index." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/masks/is_duplicated.rs b/crates/nu_plugin_polars/src/dataframe/series/masks/is_duplicated.rs index 3e4f54cbcf..97709730a9 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/masks/is_duplicated.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/masks/is_duplicated.rs @@ -18,7 +18,7 @@ impl PluginCommand for IsDuplicated { "polars is-duplicated" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates mask indicating duplicated values." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/masks/is_not_null.rs b/crates/nu_plugin_polars/src/dataframe/series/masks/is_not_null.rs index b7e506a67c..242870bcb8 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/masks/is_not_null.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/masks/is_not_null.rs @@ -20,7 +20,7 @@ impl PluginCommand for IsNotNull { "polars is-not-null" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates mask where value is not null." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/masks/is_null.rs b/crates/nu_plugin_polars/src/dataframe/series/masks/is_null.rs index bc04e7fb76..69f751d74e 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/masks/is_null.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/masks/is_null.rs @@ -22,7 +22,7 @@ impl PluginCommand for IsNull { "polars is-null" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates mask where value is null." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/masks/is_unique.rs b/crates/nu_plugin_polars/src/dataframe/series/masks/is_unique.rs index 76a1ab6193..b6438c5bf8 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/masks/is_unique.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/masks/is_unique.rs @@ -18,7 +18,7 @@ impl PluginCommand for IsUnique { "polars is-unique" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Creates mask indicating unique values." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/masks/not.rs b/crates/nu_plugin_polars/src/dataframe/series/masks/not.rs index 774f2ddeb5..2759e117fa 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/masks/not.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/masks/not.rs @@ -19,7 +19,7 @@ impl PluginCommand for NotSeries { "polars not" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Inverts boolean mask." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/masks/set.rs b/crates/nu_plugin_polars/src/dataframe/series/masks/set.rs index 3b7697c45b..d38508ad51 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/masks/set.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/masks/set.rs @@ -19,7 +19,7 @@ impl PluginCommand for SetSeries { "polars set" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Sets value where given mask is true." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/n_null.rs b/crates/nu_plugin_polars/src/dataframe/series/n_null.rs index 16aa5d0a52..cfe69853a7 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/n_null.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/n_null.rs @@ -17,7 +17,7 @@ impl PluginCommand for NNull { "polars count-null" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Counts null values." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/n_unique.rs b/crates/nu_plugin_polars/src/dataframe/series/n_unique.rs index 51c6e1bdb3..381017f9e7 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/n_unique.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/n_unique.rs @@ -19,7 +19,7 @@ impl PluginCommand for NUnique { "polars n-unique" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Counts unique values." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/rolling.rs b/crates/nu_plugin_polars/src/dataframe/series/rolling.rs index 72394d3375..b63b5048be 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/rolling.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/rolling.rs @@ -53,7 +53,7 @@ impl PluginCommand for Rolling { "polars rolling" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Rolling calculation for a series." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/shift.rs b/crates/nu_plugin_polars/src/dataframe/series/shift.rs index 58dc64ec47..51c8242e51 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/shift.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/shift.rs @@ -24,7 +24,7 @@ impl PluginCommand for Shift { "polars shift" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Shifts the values by a given period." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/string/concatenate.rs b/crates/nu_plugin_polars/src/dataframe/series/string/concatenate.rs index 3d3f3a598c..b7663bfa41 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/string/concatenate.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/string/concatenate.rs @@ -19,7 +19,7 @@ impl PluginCommand for Concatenate { "polars concatenate" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Concatenates strings with other array." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/string/contains.rs b/crates/nu_plugin_polars/src/dataframe/series/string/contains.rs index 513925b788..50068ea51b 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/string/contains.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/string/contains.rs @@ -19,7 +19,7 @@ impl PluginCommand for Contains { "polars contains" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Checks if a pattern is contained in a string." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/string/replace.rs b/crates/nu_plugin_polars/src/dataframe/series/string/replace.rs index b1c5f0ebd9..9d7d097f60 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/string/replace.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/string/replace.rs @@ -19,7 +19,7 @@ impl PluginCommand for Replace { "polars replace" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Replace the leftmost (sub)string by a regex pattern." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/string/replace_all.rs b/crates/nu_plugin_polars/src/dataframe/series/string/replace_all.rs index c1ae02218a..d88b581451 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/string/replace_all.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/string/replace_all.rs @@ -19,7 +19,7 @@ impl PluginCommand for ReplaceAll { "polars replace-all" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Replace all (sub)strings by a regex pattern." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/string/str_lengths.rs b/crates/nu_plugin_polars/src/dataframe/series/string/str_lengths.rs index ef664d8a63..417d3c0b90 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/string/str_lengths.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/string/str_lengths.rs @@ -18,7 +18,7 @@ impl PluginCommand for StrLengths { "polars str-lengths" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Get lengths of all strings." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/string/str_slice.rs b/crates/nu_plugin_polars/src/dataframe/series/string/str_slice.rs index a35ac43852..d81500a7cd 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/string/str_slice.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/string/str_slice.rs @@ -22,7 +22,7 @@ impl PluginCommand for StrSlice { "polars str-slice" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Slices the string from the start position until the selected length." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/string/strftime.rs b/crates/nu_plugin_polars/src/dataframe/series/string/strftime.rs index d793c3910f..85d3aa84a0 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/string/strftime.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/string/strftime.rs @@ -19,7 +19,7 @@ impl PluginCommand for StrFTime { "polars strftime" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Formats date based on string rule." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/string/to_lowercase.rs b/crates/nu_plugin_polars/src/dataframe/series/string/to_lowercase.rs index d3aebd693a..f12ece825c 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/string/to_lowercase.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/string/to_lowercase.rs @@ -18,7 +18,7 @@ impl PluginCommand for ToLowerCase { "polars lowercase" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Lowercase the strings in the column." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/string/to_uppercase.rs b/crates/nu_plugin_polars/src/dataframe/series/string/to_uppercase.rs index e178e57cf8..e252656d46 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/string/to_uppercase.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/string/to_uppercase.rs @@ -18,7 +18,7 @@ impl PluginCommand for ToUpperCase { "polars uppercase" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Uppercase the strings in the column." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/unique.rs b/crates/nu_plugin_polars/src/dataframe/series/unique.rs index 7626b35404..991d22b096 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/unique.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/unique.rs @@ -23,7 +23,7 @@ impl PluginCommand for Unique { "polars unique" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns unique values from a dataframe." } diff --git a/crates/nu_plugin_polars/src/dataframe/series/value_counts.rs b/crates/nu_plugin_polars/src/dataframe/series/value_counts.rs index 16471e7b9f..bb228af8bb 100644 --- a/crates/nu_plugin_polars/src/dataframe/series/value_counts.rs +++ b/crates/nu_plugin_polars/src/dataframe/series/value_counts.rs @@ -20,7 +20,7 @@ impl PluginCommand for ValueCount { "polars value-counts" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Returns a dataframe with the counts for unique values in series." } diff --git a/crates/nu_plugin_polars/src/dataframe/stub.rs b/crates/nu_plugin_polars/src/dataframe/stub.rs index 160069f04c..ff8d80fcca 100644 --- a/crates/nu_plugin_polars/src/dataframe/stub.rs +++ b/crates/nu_plugin_polars/src/dataframe/stub.rs @@ -13,7 +13,7 @@ impl PluginCommand for PolarsCmd { "polars" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Operate with data in a dataframe format." } @@ -23,7 +23,7 @@ impl PluginCommand for PolarsCmd { .input_output_types(vec![(Type::Nothing, Type::String)]) } - fn extra_usage(&self) -> &str { + fn extra_description(&self) -> &str { "You must use one of the following subcommands. Using this command as-is will only produce this help message." } diff --git a/crates/nu_plugin_python/nu_plugin_python_example.py b/crates/nu_plugin_python/nu_plugin_python_example.py index a47ce46997..1fdb5bd076 100755 --- a/crates/nu_plugin_python/nu_plugin_python_example.py +++ b/crates/nu_plugin_python/nu_plugin_python_example.py @@ -44,8 +44,8 @@ def signatures(): { "sig": { "name": "nu-python", - "usage": "Signature test for Python", - "extra_usage": "", + "description": "Signature test for Python", + "extra_description": "", "required_positional": [ { "name": "a", diff --git a/crates/nu_plugin_query/src/query.rs b/crates/nu_plugin_query/src/query.rs index 273fc858c6..89a0efc97c 100644 --- a/crates/nu_plugin_query/src/query.rs +++ b/crates/nu_plugin_query/src/query.rs @@ -12,10 +12,6 @@ impl Query { pub fn new() -> Self { Default::default() } - - pub fn usage() -> &'static str { - "Usage: query" - } } impl Plugin for Query { @@ -44,7 +40,7 @@ impl SimplePluginCommand for QueryCommand { "query" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "Show all the query commands" } diff --git a/crates/nu_plugin_query/src/query_json.rs b/crates/nu_plugin_query/src/query_json.rs index ee8b919d12..b5f8bd7add 100644 --- a/crates/nu_plugin_query/src/query_json.rs +++ b/crates/nu_plugin_query/src/query_json.rs @@ -12,7 +12,7 @@ impl SimplePluginCommand for QueryJson { "query json" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "execute json query on json file (open --raw | query json 'query string')" } diff --git a/crates/nu_plugin_query/src/query_web.rs b/crates/nu_plugin_query/src/query_web.rs index 2d57af6021..e6723d72f4 100644 --- a/crates/nu_plugin_query/src/query_web.rs +++ b/crates/nu_plugin_query/src/query_web.rs @@ -14,7 +14,7 @@ impl SimplePluginCommand for QueryWeb { "query web" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "execute selector query on html/web" } diff --git a/crates/nu_plugin_query/src/query_webpage_info.rs b/crates/nu_plugin_query/src/query_webpage_info.rs index f38f7241f5..74a7be94c3 100644 --- a/crates/nu_plugin_query/src/query_webpage_info.rs +++ b/crates/nu_plugin_query/src/query_webpage_info.rs @@ -12,7 +12,7 @@ impl SimplePluginCommand for QueryWebpageInfo { "query webpage-info" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "uses the webpage crate to extract info from html: title, description, language, links, RSS feeds, Opengraph, Schema.org, and more" } diff --git a/crates/nu_plugin_query/src/query_xml.rs b/crates/nu_plugin_query/src/query_xml.rs index 09bbde13df..5f46ce4355 100644 --- a/crates/nu_plugin_query/src/query_xml.rs +++ b/crates/nu_plugin_query/src/query_xml.rs @@ -15,7 +15,7 @@ impl SimplePluginCommand for QueryXml { "query xml" } - fn usage(&self) -> &str { + fn description(&self) -> &str { "execute xpath query on xml" } diff --git a/crates/nu_plugin_stress_internals/src/main.rs b/crates/nu_plugin_stress_internals/src/main.rs index 79cbb92549..74539a04e0 100644 --- a/crates/nu_plugin_stress_internals/src/main.rs +++ b/crates/nu_plugin_stress_internals/src/main.rs @@ -201,8 +201,8 @@ fn signatures() -> Vec { vec![json!({ "sig": { "name": "stress_internals", - "usage": "Used to test behavior of plugin protocol", - "extra_usage": "", + "description": "Used to test behavior of plugin protocol", + "extra_description": "", "search_terms": [], "required_positional": [], "optional_positional": [], diff --git a/src/command.rs b/src/command.rs index 5ba8a60996..57ecd98edc 100644 --- a/src/command.rs +++ b/src/command.rs @@ -304,7 +304,7 @@ impl Command for Nu { fn signature(&self) -> Signature { let mut signature = Signature::build("nu") - .usage("The nushell language and shell.") + .description("The nushell language and shell.") .named( "commands", SyntaxShape::String, @@ -467,7 +467,7 @@ impl Command for Nu { signature } - fn usage(&self) -> &str { + fn description(&self) -> &str { "The nushell language and shell." } diff --git a/src/ide.rs b/src/ide.rs index 0a24bcd013..a08e7afcdf 100644 --- a/src/ide.rs +++ b/src/ide.rs @@ -203,11 +203,11 @@ pub fn hover(engine_state: &mut EngineState, file_path: &str, location: &Value) let mut description = String::new(); // first description - description.push_str(&format!("{}\n", decl.usage())); + description.push_str(&format!("{}\n", decl.description())); // additional description - if !decl.extra_usage().is_empty() { - description.push_str(&format!("\n{}\n", decl.extra_usage())); + if !decl.extra_description().is_empty() { + description.push_str(&format!("\n{}\n", decl.extra_description())); } // Usage diff --git a/tests/plugins/register.rs b/tests/plugins/register.rs index 7ce641fec0..9260c5f4c1 100644 --- a/tests/plugins/register.rs +++ b/tests/plugins/register.rs @@ -11,7 +11,7 @@ fn help() { ); assert!(actual.out.contains("test example 1")); - assert!(actual.out.contains("Extra usage for example one")); + assert!(actual.out.contains("Extra description for example one")); }) } diff --git a/tests/repl/test_parser.rs b/tests/repl/test_parser.rs index a65e2c9a0f..b5ab6d735a 100644 --- a/tests/repl/test_parser.rs +++ b/tests/repl/test_parser.rs @@ -249,31 +249,31 @@ fn recursive_parse() -> TestResult { } #[test] -fn commands_have_usage() -> TestResult { +fn commands_have_description() -> TestResult { run_test_contains( r#" # This is a test # - # To see if I have cool usage + # To see if I have cool description def foo [] {} help foo"#, - "cool usage", + "cool description", ) } #[test] -fn commands_from_crlf_source_have_short_usage() -> TestResult { +fn commands_from_crlf_source_have_short_description() -> TestResult { run_test_contains( - "# This is a test\r\n#\r\n# To see if I have cool usage\r\ndef foo [] {}\r\nscope commands | where name == foo | get usage.0", + "# This is a test\r\n#\r\n# To see if I have cool description\r\ndef foo [] {}\r\nscope commands | where name == foo | get description.0", "This is a test", ) } #[test] -fn commands_from_crlf_source_have_extra_usage() -> TestResult { +fn commands_from_crlf_source_have_extra_description() -> TestResult { run_test_contains( - "# This is a test\r\n#\r\n# To see if I have cool usage\r\ndef foo [] {}\r\nscope commands | where name == foo | get extra_usage.0", - "To see if I have cool usage", + "# This is a test\r\n#\r\n# To see if I have cool description\r\ndef foo [] {}\r\nscope commands | where name == foo | get extra_description.0", + "To see if I have cool description", ) } diff --git a/tests/scope/mod.rs b/tests/scope/mod.rs index bfcbb14958..ffcaa80bd7 100644 --- a/tests/scope/mod.rs +++ b/tests/scope/mod.rs @@ -92,7 +92,7 @@ fn correct_scope_modules_fields() { let module_setup = r#" # nice spam # - # and some extra usage for spam + # and some extra description for spam export module eggs { export module bacon { @@ -120,17 +120,17 @@ fn correct_scope_modules_fields() { let inp = &[ "use spam.nu", - "scope modules | where name == spam | get 0.usage", + "scope modules | where name == spam | get 0.description", ]; let actual = nu!(cwd: dirs.test(), &inp.join("; ")); assert_eq!(actual.out, "nice spam"); let inp = &[ "use spam.nu", - "scope modules | where name == spam | get 0.extra_usage", + "scope modules | where name == spam | get 0.extra_description", ]; let actual = nu!(cwd: dirs.test(), &inp.join("; ")); - assert_eq!(actual.out, "and some extra usage for spam"); + assert_eq!(actual.out, "and some extra description for spam"); let inp = &[ "use spam.nu", @@ -209,7 +209,7 @@ fn correct_scope_aliases_fields() { let inp = &[ "use spam.nu", - "scope aliases | where name == 'spam xaz' | get 0.usage", + "scope aliases | where name == 'spam xaz' | get 0.description", ]; let actual = nu!(cwd: dirs.test(), &inp.join("; ")); assert_eq!(actual.out, "nice alias"); @@ -259,14 +259,14 @@ fn correct_scope_externs_fields() { let inp = &[ "use spam.nu", - "scope externs | where name == 'spam git' | get 0.usage", + "scope externs | where name == 'spam git' | get 0.description", ]; let actual = nu!(cwd: dirs.test(), &inp.join("; ")); assert_eq!(actual.out, "nice extern"); let inp = &[ "use spam.nu", - "scope externs | where name == 'spam git' | get 0.usage | str contains (char nl)", + "scope externs | where name == 'spam git' | get 0.description | str contains (char nl)", ]; let actual = nu!(cwd: dirs.test(), &inp.join("; ")); assert_eq!(actual.out, "false");