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

@ -40,6 +40,7 @@ impl WholeStreamCommand for SubCommand {
Some('d'),
)
.rest(
"rest",
SyntaxShape::ColumnPath,
"optionally, draw gradients using text from column paths",
)

View File

@ -15,6 +15,7 @@ impl WholeStreamCommand for SubCommand {
fn signature(&self) -> Signature {
Signature::build("ansi strip").rest(
"rest",
SyntaxShape::ColumnPath,
"optionally, remove ansi sequences by column paths",
)

View File

@ -25,6 +25,7 @@ impl WholeStreamCommand for Exec {
Signature::build("exec")
.required("command", SyntaxShape::FilePath, "the command to execute")
.rest(
"rest",
SyntaxShape::GlobPattern,
"any additional arguments for the command",
)

View File

@ -19,7 +19,7 @@ impl WholeStreamCommand for Kill {
SyntaxShape::Int,
"process id of process that is to be killed",
)
.rest(SyntaxShape::Int, "rest of processes to kill")
.rest("rest", SyntaxShape::Int, "rest of processes to kill")
.switch("force", "forcefully kill the process", Some('f'))
.switch("quiet", "won't print anything to the console", Some('q'));

View File

@ -43,7 +43,7 @@ impl WholeStreamCommand for RunExternalCommand {
}
fn signature(&self) -> Signature {
Signature::build(self.name()).rest(SyntaxShape::Any, "external command arguments")
Signature::build(self.name()).rest("rest", SyntaxShape::Any, "external command arguments")
}
fn usage(&self) -> &str {

View File

@ -21,7 +21,7 @@ impl WholeStreamCommand for Sleep {
fn signature(&self) -> Signature {
Signature::build("sleep")
.required("duration", SyntaxShape::Duration, "time to sleep")
.rest(SyntaxShape::Duration, "additional time")
.rest("rest", SyntaxShape::Duration, "additional time")
}
fn usage(&self) -> &str {

View File

@ -16,7 +16,7 @@ impl WholeStreamCommand for Which {
fn signature(&self) -> Signature {
Signature::build("which")
.required("application", SyntaxShape::String, "application")
.rest(SyntaxShape::String, "additional applications")
.rest("rest", SyntaxShape::String, "additional applications")
.switch("all", "list all executables", Some('a'))
}