Allow different names for ...rest (#3954)

* Allow different names for ...rest

* Resolves #3945

* This change requires an explicit name for the rest argument in `WholeStreamCommand`,
  which is why there are so many changed files.

* Remove redundant clone

* Add tests
This commit is contained in:
Hristo Filaretov
2021-08-26 19:58:53 +02:00
committed by GitHub
parent 88817a8f10
commit b8e2bdd6b1
97 changed files with 270 additions and 87 deletions

View File

@ -12,6 +12,7 @@ impl WholeStreamCommand for Mkdir {
fn signature(&self) -> Signature {
Signature::build("mkdir")
.rest(
"rest",
SyntaxShape::FilePath,
"the name(s) of the path(s) to create",
)

View File

@ -26,7 +26,11 @@ impl WholeStreamCommand for Remove {
)
.switch("recursive", "delete subdirectories recursively", Some('r'))
.switch("force", "suppress error when no file", Some('f'))
.rest(SyntaxShape::GlobPattern, "the file path(s) to remove")
.rest(
"rest",
SyntaxShape::GlobPattern,
"the file path(s) to remove",
)
}
fn usage(&self) -> &str {

View File

@ -19,7 +19,7 @@ impl WholeStreamCommand for Touch {
SyntaxShape::FilePath,
"the path of the file you want to create",
)
.rest(SyntaxShape::FilePath, "additional files to create")
.rest("rest", SyntaxShape::FilePath, "additional files to create")
}
fn usage(&self) -> &str {
"Creates one or more files."