forked from extern/nushell
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:
committed by
GitHub
parent
3ab9f0b90a
commit
95b78eee25
@ -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")
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user