Enforce required, optional, and rest positional arguments start with an uppercase and end with a period. (#11285)

# Description

This updates all the positional arguments (except with
`--features=dataframe` or `--features=extra`) to start with an uppercase
letter and end with a period.

Part of #5066, specifically [this
comment](/nushell/nushell/issues/5066#issuecomment-1421528910)

Some arguments had example data removed from them because it also
appears in the examples.

There are other inconsistencies in positional arguments I noticed while
making the tests pass which I will bring up in #5066.

# User-Facing Changes

Positional arguments are now consistent

# Tests + Formatting

- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

# After Submitting

Automatic documentation updates
This commit is contained in:
Eric Hodel
2023-12-14 22:32:37 -08:00
committed by GitHub
parent c2b684464f
commit 5b01685fc3
196 changed files with 383 additions and 281 deletions

View File

@ -43,7 +43,7 @@ impl Command for Cd {
fn signature(&self) -> nu_protocol::Signature {
Signature::build("cd")
.input_output_types(vec![(Type::Nothing, Type::Nothing)])
.optional("path", SyntaxShape::Directory, "the path to change to")
.optional("path", SyntaxShape::Directory, "The path to change to.")
.input_output_types(vec![
(Type::Nothing, Type::Nothing),
(Type::String, Type::Nothing),

View File

@ -39,8 +39,8 @@ impl Command for Cp {
fn signature(&self) -> Signature {
Signature::build("cp-old")
.input_output_types(vec![(Type::Nothing, Type::Nothing)])
.required("source", SyntaxShape::GlobPattern, "the place to copy from")
.required("destination", SyntaxShape::Filepath, "the place to copy to")
.required("source", SyntaxShape::GlobPattern, "The place to copy from.")
.required("destination", SyntaxShape::Filepath, "The place to copy to.")
.switch(
"recursive",
"copy recursively through subdirectories",

View File

@ -21,7 +21,7 @@ impl Command for Glob {
fn signature(&self) -> Signature {
Signature::build("glob")
.input_output_types(vec![(Type::Nothing, Type::List(Box::new(Type::String)))])
.required("glob", SyntaxShape::String, "the glob expression")
.required("glob", SyntaxShape::String, "The glob expression.")
.named(
"depth",
SyntaxShape::Int,

View File

@ -39,7 +39,7 @@ impl Command for Ls {
Signature::build("ls")
.input_output_types(vec![(Type::Nothing, Type::Table(vec![]))])
// Using a string instead of a glob pattern shape so it won't auto-expand
.optional("pattern", SyntaxShape::String, "the glob pattern to use")
.optional("pattern", SyntaxShape::String, "The glob pattern to use.")
.switch("all", "Show hidden files", Some('a'))
.switch(
"long",

View File

@ -23,7 +23,7 @@ impl Command for Mkdir {
.rest(
"rest",
SyntaxShape::Directory,
"the name(s) of the path(s) to create",
"The name(s) of the path(s) to create.",
)
.switch("verbose", "print created path(s).", Some('v'))
.category(Category::FileSystem)

View File

@ -33,12 +33,12 @@ impl Command for Mv {
.required(
"source",
SyntaxShape::GlobPattern,
"the location to move files/directories from",
"The location to move files/directories from.",
)
.required(
"destination",
SyntaxShape::Filepath,
"the location to move files/directories to",
"The location to move files/directories to.",
)
.switch(
"verbose",

View File

@ -41,11 +41,11 @@ impl Command for Open {
fn signature(&self) -> nu_protocol::Signature {
Signature::build("open")
.input_output_types(vec![(Type::Nothing, Type::Any), (Type::String, Type::Any)])
.optional("filename", SyntaxShape::Filepath, "the filename to use")
.optional("filename", SyntaxShape::Filepath, "The filename to use.")
.rest(
"filenames",
SyntaxShape::Filepath,
"optional additional files to open",
"Optional additional files to open.",
)
.switch("raw", "open file as raw binary", Some('r'))
.category(Category::FileSystem)

View File

@ -44,7 +44,7 @@ impl Command for Rm {
.required(
"filename",
SyntaxShape::GlobPattern,
"the file or files you want to remove",
"The file or files you want to remove.",
)
.switch(
"trash",
@ -68,7 +68,7 @@ impl Command for Rm {
.rest(
"rest",
SyntaxShape::GlobPattern,
"additional file path(s) to remove",
"Additional file path(s) to remove.",
)
.category(Category::FileSystem)
}

View File

@ -42,7 +42,7 @@ impl Command for Save {
fn signature(&self) -> nu_protocol::Signature {
Signature::build("save")
.input_output_types(vec![(Type::Any, Type::Nothing)])
.required("filename", SyntaxShape::Filepath, "the filename to use")
.required("filename", SyntaxShape::Filepath, "The filename to use.")
.named(
"stderr",
SyntaxShape::Filepath,

View File

@ -30,7 +30,7 @@ impl Command for Start {
fn signature(&self) -> nu_protocol::Signature {
Signature::build("start")
.input_output_types(vec![(Type::Nothing, Type::Any), (Type::String, Type::Any)])
.required("path", SyntaxShape::String, "path to open")
.required("path", SyntaxShape::String, "Path to open.")
.category(Category::FileSystem)
}

View File

@ -29,7 +29,7 @@ impl Command for Touch {
.required(
"filename",
SyntaxShape::Filepath,
"the path of the file you want to create",
"The path of the file you want to create.",
)
.named(
"reference",
@ -52,7 +52,7 @@ impl Command for Touch {
"do not create the file if it does not exist",
Some('c'),
)
.rest("rest", SyntaxShape::Filepath, "additional files to create")
.rest("rest", SyntaxShape::Filepath, "Additional files to create.")
.category(Category::FileSystem)
}

View File

@ -54,7 +54,7 @@ impl Command for UCp {
.switch("progress", "display a progress bar", Some('p'))
.switch("no-clobber", "do not overwrite an existing file", Some('n'))
.switch("debug", "explain how a file is copied. Implies -v", None)
.rest("paths", SyntaxShape::Filepath, "Copy SRC file/s to DEST")
.rest("paths", SyntaxShape::Filepath, "Copy SRC file/s to DEST.")
.allow_variants_without_examples(true)
.category(Category::FileSystem)
}

View File

@ -33,7 +33,7 @@ impl Command for UMkdir {
.rest(
"rest",
SyntaxShape::Directory,
"the name(s) of the path(s) to create",
"The name(s) of the path(s) to create.",
)
.switch(
"verbose",

View File

@ -40,10 +40,10 @@ impl Command for Watch {
fn signature(&self) -> nu_protocol::Signature {
Signature::build("watch")
.input_output_types(vec![(Type::Nothing, Type::Table(vec![]))])
.required("path", SyntaxShape::Filepath, "the path to watch. Can be a file or directory")
.required("path", SyntaxShape::Filepath, "The path to watch. Can be a file or directory.")
.required("closure",
SyntaxShape::Closure(Some(vec![SyntaxShape::String, SyntaxShape::String, SyntaxShape::String])),
"Some Nu code to run whenever a file changes. The closure will be passed `operation`, `path`, and `new_path` (for renames only) arguments in that order")
"Some Nu code to run whenever a file changes. The closure will be passed `operation`, `path`, and `new_path` (for renames only) arguments in that order.")
.named(
"debounce-ms",
SyntaxShape::Int,