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

@@ -356,7 +356,8 @@ mod tests {
#[test]
fn completes_internal_command_names() {
let registry: VecRegistry =
vec![Signature::build("echo").rest(SyntaxShape::Any, "the values to echo")].into();
vec![Signature::build("echo").rest("rest", SyntaxShape::Any, "the values to echo")]
.into();
let line = "echo 1 | echo 2";
assert_eq!(
@@ -402,7 +403,7 @@ mod tests {
fn completes_flags() {
let registry: VecRegistry = vec![Signature::build("du")
.switch("recursive", "the values to echo", None)
.rest(SyntaxShape::Any, "blah")]
.rest("rest", SyntaxShape::Any, "blah")]
.into();
let line = "du --recurs";
@@ -442,7 +443,7 @@ mod tests {
fn completes_flags_with_just_a_single_hyphen() {
let registry: VecRegistry = vec![Signature::build("du")
.switch("recursive", "the values to echo", None)
.rest(SyntaxShape::Any, "blah")]
.rest("rest", SyntaxShape::Any, "blah")]
.into();
let line = "du -";
@@ -459,7 +460,8 @@ mod tests {
#[test]
fn completes_arguments() {
let registry: VecRegistry =
vec![Signature::build("echo").rest(SyntaxShape::Any, "the values to echo")].into();
vec![Signature::build("echo").rest("rest", SyntaxShape::Any, "the values to echo")]
.into();
let line = "echo 1 | echo 2";
assert_eq!(