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

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

View File

@ -16,7 +16,7 @@ impl PluginCommand for CollectBytes {
"example collect-bytes"
}
fn usage(&self) -> &str {
fn description(&self) -> &str {
"Example transformer to byte stream"
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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