Change the usage misnomer to "description" (#13598)

# Description
    
The meaning of the word usage is specific to describing how a command
function is *used* and not a synonym for general description. Usage can
be used to describe the SYNOPSIS or EXAMPLES sections of a man page
where the permitted argument combinations are shown or example *uses*
are given.
Let's not confuse people and call it what it is a description.

Our `help` command already creates its own *Usage* section based on the
available arguments and doesn't refer to the description with usage.

# User-Facing Changes

`help commands` and `scope commands` will now use `description` or
`extra_description`
`usage`-> `description`
`extra_usage` -> `extra_description`

Breaking change in the plugin protocol:

In the signature record communicated with the engine.
`usage`-> `description`
`extra_usage` -> `extra_description`

The same rename also takes place for the methods on
`SimplePluginCommand` and `PluginCommand`

# Tests + Formatting
- Updated plugin protocol specific changes
# After Submitting
- [ ] update plugin protocol doc
This commit is contained in:
Stefan Holderbach
2024-08-22 12:02:08 +02:00
committed by GitHub
parent 3ab9f0b90a
commit 95b78eee25
597 changed files with 1085 additions and 1039 deletions

View File

@ -193,7 +193,7 @@ impl Command for Char {
true
}
fn usage(&self) -> &str {
fn description(&self) -> &str {
"Output special characters (e.g., 'newline')."
}

View File

@ -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."
}

View File

@ -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

View File

@ -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."#
}

View File

@ -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

View File

@ -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."
}

View File

@ -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."
}

View File

@ -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."
}

View File

@ -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."
}

View File

@ -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."
}

View File

@ -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."
}

View File

@ -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."
}

View File

@ -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."
}

View File

@ -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."
}

View File

@ -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."
}

View File

@ -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."
}

View File

@ -56,7 +56,7 @@ impl Command for SubCommand {
)
}
fn usage(&self) -> &str {
fn description(&self) -> &str {
"Split a string's words into separate rows."
}

View File

@ -28,7 +28,7 @@ impl Command for SubCommand {
.category(Category::Strings)
}
fn usage(&self) -> &str {
fn description(&self) -> &str {
"Capitalize first letter of text."
}

View File

@ -28,7 +28,7 @@ impl Command for SubCommand {
.category(Category::Strings)
}
fn usage(&self) -> &str {
fn description(&self) -> &str {
"Make text lowercase."
}

View File

@ -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."
}

View File

@ -28,7 +28,7 @@ impl Command for SubCommand {
.category(Category::Strings)
}
fn usage(&self) -> &str {
fn description(&self) -> &str {
"Make text uppercase."
}

View File

@ -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."
}

View File

@ -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."
}

View File

@ -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."
}

View File

@ -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."
}

View File

@ -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."
}

View File

@ -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."
}

View File

@ -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."
}

View File

@ -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."
}

View File

@ -65,7 +65,7 @@ impl Command for SubCommand {
.category(Category::Strings)
}
fn usage(&self) -> &str {
fn description(&self) -> &str {
"Find and replace text."
}

View File

@ -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."
}

View File

@ -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."
}

View File

@ -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."
}

View File

@ -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."
}

View File

@ -63,7 +63,7 @@ impl Command for SubCommand {
)
.category(Category::Strings)
}
fn usage(&self) -> &str {
fn description(&self) -> &str {
"Trim whitespace or specific character."
}