Add token representation to remaining arguments

Before, when adding parsed information to the IRemainingArguments.Parsed,
we used the name of the parsed option ('foo') instead of it's
representation ('--foo'). This commit fixes that.
This commit is contained in:
Patrik Svensson
2024-04-23 14:04:00 +02:00
committed by Patrik Svensson
parent 95bff47b85
commit 71f762f646
6 changed files with 22 additions and 26 deletions

View File

@@ -215,7 +215,7 @@ public sealed partial class CommandAppTests
dog.Name.ShouldBe("\" -Rufus --' ");
});
result.Context.Remaining.Parsed.Count.ShouldBe(1);
result.Context.ShouldHaveRemainingArgument("order-by", values: new[] { "\"-size\"", " ", string.Empty });
result.Context.ShouldHaveRemainingArgument("--order-by", values: new[] { "\"-size\"", " ", string.Empty });
}
[Fact]
@@ -844,7 +844,7 @@ public sealed partial class CommandAppTests
// Then
result.Context.ShouldNotBeNull();
result.Context.Remaining.Parsed.Count.ShouldBe(1);
result.Context.ShouldHaveRemainingArgument("foo", values: new[] { "bar" });
result.Context.ShouldHaveRemainingArgument("--foo", values: new[] { "bar" });
}
[Fact]
@@ -875,8 +875,8 @@ public sealed partial class CommandAppTests
// Then
result.Context.ShouldNotBeNull();
result.Context.Remaining.Parsed.Count.ShouldBe(2);
result.Context.ShouldHaveRemainingArgument("foo", values: new[] { "bar" });
result.Context.ShouldHaveRemainingArgument("f", values: new[] { "baz" });
result.Context.ShouldHaveRemainingArgument("--foo", values: new[] { "bar" });
result.Context.ShouldHaveRemainingArgument("-f", values: new[] { "baz" });
result.Context.Remaining.Raw.Count.ShouldBe(5);
result.Context.Remaining.Raw.ShouldBe(new[]
{
@@ -909,7 +909,7 @@ public sealed partial class CommandAppTests
// Then
result.Context.ShouldNotBeNull();
result.Context.Remaining.Parsed.Count.ShouldBe(1);
result.Context.ShouldHaveRemainingArgument("foo", values: new[] { (string)null });
result.Context.ShouldHaveRemainingArgument("--foo", values: new[] { (string)null });
}
[Fact]