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

@ -165,9 +165,9 @@ impl Command for Char {
.optional(
"character",
SyntaxShape::Any,
"the name of the character to output",
"The name of the character to output.",
)
.rest("rest", SyntaxShape::Any, "multiple Unicode bytes")
.rest("rest", SyntaxShape::Any, "Multiple Unicode bytes.")
.switch("list", "List all supported character names", Some('l'))
.switch("unicode", "Unicode string i.e. 1f378", Some('u'))
.switch("integer", "Create a codepoint from an integer", Some('i'))

View File

@ -25,7 +25,7 @@ impl Command for Decode {
fn signature(&self) -> nu_protocol::Signature {
Signature::build("decode")
.input_output_types(vec![(Type::Binary, Type::String)])
.optional("encoding", SyntaxShape::String, "the text encoding to use")
.optional("encoding", SyntaxShape::String, "The text encoding to use.")
.category(Category::Strings)
}

View File

@ -44,7 +44,7 @@ impl Command for DecodeBase64 {
.rest(
"rest",
SyntaxShape::CellPath,
"For a data structure input, decode data at the given cell paths",
"For a data structure input, decode data at the given cell paths.",
)
.category(Category::Hash)
}

View File

@ -29,7 +29,7 @@ impl Command for Encode {
fn signature(&self) -> nu_protocol::Signature {
Signature::build("encode")
.input_output_types(vec![(Type::String, Type::Binary)])
.required("encoding", SyntaxShape::String, "the text encoding to use")
.required("encoding", SyntaxShape::String, "The text encoding to use.")
.switch(
"ignore-errors",
"when a character isn't in the given encoding, replace with a HTML entity (like `🎈`)",

View File

@ -45,7 +45,7 @@ impl Command for EncodeBase64 {
.rest(
"rest",
SyntaxShape::CellPath,
"For a data structure input, encode data at the given cell paths",
"For a data structure input, encode data at the given cell paths.",
)
.category(Category::Hash)
}

View File

@ -32,7 +32,7 @@ impl Command for FormatDate {
.optional(
"format string",
SyntaxShape::String,
"the desired format date",
"The desired format date.",
)
.category(Category::Date)
}

View File

@ -40,12 +40,12 @@ impl Command for FormatDuration {
.required(
"format value",
SyntaxShape::String,
"the unit in which to display the duration",
"The unit in which to display the duration.",
)
.rest(
"rest",
SyntaxShape::CellPath,
"For a data structure input, format duration at the given cell paths",
"For a data structure input, format duration at the given cell paths.",
)
.category(Category::Strings)
}

View File

@ -37,12 +37,12 @@ impl Command for FormatFilesize {
.required(
"format value",
SyntaxShape::String,
"the format into which convert the file sizes",
"The format into which convert the file sizes.",
)
.rest(
"rest",
SyntaxShape::CellPath,
"For a data structure input, format filesizes at the given cell paths",
"For a data structure input, format filesizes at the given cell paths.",
)
.category(Category::Strings)
}

View File

@ -28,11 +28,7 @@ impl Command for Parse {
fn signature(&self) -> nu_protocol::Signature {
Signature::build("parse")
.required(
"pattern",
SyntaxShape::String,
"the pattern to match. Eg) \"{foo}: {bar}\"",
)
.required("pattern", SyntaxShape::String, "The pattern to match.")
.input_output_types(vec![
(Type::String, Type::Table(vec![])),
(Type::List(Box::new(Type::Any)), Type::Table(vec![])),

View File

@ -28,14 +28,14 @@ impl Command for SubCommand {
.required(
"separator",
SyntaxShape::String,
"the character or string that denotes what separates columns",
"The character or string that denotes what separates columns.",
)
.switch("collapse-empty", "remove empty columns", Some('c'))
.switch("regex", "separator is a regular expression", Some('r'))
.rest(
"rest",
SyntaxShape::String,
"column names to give the new columns",
"Column names to give the new columns.",
)
.category(Category::Strings)
}

View File

@ -24,7 +24,7 @@ impl Command for SubCommand {
.required(
"separator",
SyntaxShape::Any,
"the value that denotes what separates the list",
"The value that denotes what separates the list.",
)
.switch(
"regex",

View File

@ -27,7 +27,7 @@ impl Command for SubCommand {
.required(
"separator",
SyntaxShape::String,
"a character or regex that denotes what separates rows",
"A character or regex that denotes what separates rows.",
)
.named(
"number",

View File

@ -29,7 +29,7 @@ impl Command for SubCommand {
.rest(
"rest",
SyntaxShape::CellPath,
"For a data structure input, convert strings at the given cell paths",
"For a data structure input, convert strings at the given cell paths.",
)
.category(Category::Strings)
}

View File

@ -29,7 +29,7 @@ impl Command for SubCommand {
.rest(
"rest",
SyntaxShape::CellPath,
"For a data structure input, convert strings at the given cell paths",
"For a data structure input, convert strings at the given cell paths.",
)
.category(Category::Strings)
}

View File

@ -28,7 +28,7 @@ impl Command for SubCommand {
.rest(
"rest",
SyntaxShape::CellPath,
"For a data structure input, convert strings at the given cell paths",
"For a data structure input, convert strings at the given cell paths.",
)
.category(Category::Strings)
}

View File

@ -39,11 +39,11 @@ impl Command for SubCommand {
(Type::Record(vec![]), Type::Record(vec![])),
(Type::List(Box::new(Type::String)), Type::List(Box::new(Type::Bool)))
])
.required("string", SyntaxShape::String, "the substring to find")
.required("string", SyntaxShape::String, "The substring to find.")
.rest(
"rest",
SyntaxShape::CellPath,
"For a data structure input, check strings at the given cell paths, and replace with result",
"For a data structure input, check strings at the given cell paths, and replace with result.",
)
.switch("ignore-case", "search is case insensitive", Some('i'))
.switch("not", "does not contain", Some('n'))

View File

@ -36,12 +36,12 @@ impl Command for SubCommand {
.required(
"compare-string",
SyntaxShape::String,
"the first string to compare",
"The first string to compare.",
)
.rest(
"rest",
SyntaxShape::CellPath,
"For a data structure input, check strings at the given cell paths, and replace with result",
"For a data structure input, check strings at the given cell paths, and replace with result.",
)
.category(Category::Strings)
}

View File

@ -36,11 +36,11 @@ impl Command for SubCommand {
(Type::Record(vec![]), Type::Record(vec![])),
])
.allow_variants_without_examples(true)
.required("string", SyntaxShape::String, "the string to match")
.required("string", SyntaxShape::String, "The string to match.")
.rest(
"rest",
SyntaxShape::CellPath,
"For a data structure input, check strings at the given cell paths, and replace with result",
"For a data structure input, check strings at the given cell paths, and replace with result.",
)
.switch("ignore-case", "search is case insensitive", Some('i'))
.category(Category::Strings)

View File

@ -44,7 +44,7 @@ impl Command for SubCommand {
(Type::Record(vec![]), Type::Record(vec![])),
])
.allow_variants_without_examples(true)
.required("string", SyntaxShape::String, "the string to find in the input")
.required("string", SyntaxShape::String, "The string to find in the input.")
.switch(
"grapheme-clusters",
"count indexes using grapheme clusters (all visible chars have length 1)",
@ -58,7 +58,7 @@ impl Command for SubCommand {
.rest(
"rest",
SyntaxShape::CellPath,
"For a data structure input, search strings at the given cell paths, and replace with result",
"For a data structure input, search strings at the given cell paths, and replace with result.",
)
.named(
"range",

View File

@ -23,7 +23,7 @@ impl Command for StrJoin {
.optional(
"separator",
SyntaxShape::String,
"optional separator to use when creating string",
"Optional separator to use when creating string.",
)
.allow_variants_without_examples(true)
.category(Category::Strings)

View File

@ -49,7 +49,7 @@ impl Command for SubCommand {
.rest(
"rest",
SyntaxShape::CellPath,
"For a data structure input, replace strings at the given cell paths with their length",
"For a data structure input, replace strings at the given cell paths with their length.",
)
.category(Category::Strings)
}

View File

@ -44,12 +44,12 @@ impl Command for SubCommand {
Type::List(Box::new(Type::String)),
),
])
.required("find", SyntaxShape::String, "the pattern to find")
.required("replace", SyntaxShape::String, "the replacement string")
.required("find", SyntaxShape::String, "The pattern to find.")
.required("replace", SyntaxShape::String, "The replacement string.")
.rest(
"rest",
SyntaxShape::CellPath,
"For a data structure input, operate on strings at the given cell paths",
"For a data structure input, operate on strings at the given cell paths.",
)
.switch("all", "replace all occurrences of the pattern", Some('a'))
.switch(

View File

@ -29,7 +29,7 @@ impl Command for SubCommand {
.rest(
"rest",
SyntaxShape::CellPath,
"For a data structure input, reverse strings at the given cell paths",
"For a data structure input, reverse strings at the given cell paths.",
)
.category(Category::Strings)
}

View File

@ -38,11 +38,11 @@ impl Command for SubCommand {
(Type::Record(vec![]), Type::Record(vec![])),
])
.allow_variants_without_examples(true)
.required("string", SyntaxShape::String, "the string to match")
.required("string", SyntaxShape::String, "The string to match.")
.rest(
"rest",
SyntaxShape::CellPath,
"For a data structure input, check strings at the given cell paths, and replace with result",
"For a data structure input, check strings at the given cell paths, and replace with result.",
)
.switch("ignore-case", "search is case insensitive", Some('i'))
.category(Category::Strings)

View File

@ -63,12 +63,12 @@ impl Command for SubCommand {
.required(
"range",
SyntaxShape::Any,
"the indexes to substring [start end]",
"The indexes to substring [start end].",
)
.rest(
"rest",
SyntaxShape::CellPath,
"For a data structure input, turn strings at the given cell paths into substrings",
"For a data structure input, turn strings at the given cell paths into substrings.",
)
.category(Category::Strings)
}

View File

@ -49,7 +49,7 @@ impl Command for SubCommand {
.rest(
"rest",
SyntaxShape::CellPath,
"For a data structure input, trim strings at the given cell paths",
"For a data structure input, trim strings at the given cell paths.",
)
.named(
"char",