Skip to content

Commit ae5e6fc

Browse files
authored
Extension methods for Option<T> (#722)
* add `Option` extension methods to provide equivalent functionality to the existing `ArgumentExtensions` * rename `ParseResult.Suggestions` -> `GetSuggestions` * simplify `ExistingOnly` overloads and improve tests
1 parent 08c6d9b commit ae5e6fc

File tree

9 files changed

+524
-317
lines changed

9 files changed

+524
-317
lines changed

src/System.CommandLine.Benchmarks/CommandLine/Perf_Suggestions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public void Setup_FromParseResult()
6969
[Benchmark]
7070
public void SuggestionsFromParseResult()
7171
{
72-
_testParseResult.Suggestions("--wrong".Length + 1).Consume(new Consumer());
72+
_testParseResult.GetSuggestions("--wrong".Length + 1).Consume(new Consumer());
7373
}
7474
}
7575
}

src/System.CommandLine.Tests/ParseDiagramTests.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,9 @@ public void Parse_result_diagram_helps_explain_parse_operation()
4141
public void Parse_result_diagram_displays_unmatched_tokens()
4242
{
4343
var command = new Command("command")
44-
{
45-
new Option("-x")
46-
{
47-
Argument = new Argument
48-
{
49-
Arity = ArgumentArity.ExactlyOne
50-
}
51-
.FromAmong("arg1", "arg2", "arg3")
52-
}
53-
};
44+
{
45+
new Option<string>("-x").FromAmong("arg1", "arg2", "arg3")
46+
};
5447

5548
var result = command.Parse("command -x ar");
5649

0 commit comments

Comments
 (0)