Skip to content

Commit b1399e4

Browse files
committed
use ArgumentResult instead of SymbolResult in TryConvertArgument
1 parent ae5e6fc commit b1399e4

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

src/System.CommandLine.Tests/Binding/TypeConversionTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class TypeConversionTests
1818
[Fact]
1919
public void Custom_types_and_conversion_logic_can_be_specified()
2020
{
21-
var argument = new Argument<MyCustomType>((SymbolResult parsed, out MyCustomType value) =>
21+
var argument = new Argument<MyCustomType>((ArgumentResult parsed, out MyCustomType value) =>
2222
{
2323
var custom = new MyCustomType();
2424
foreach (var a in parsed.Tokens)
@@ -261,7 +261,7 @@ public void When_argument_cannot_be_parsed_as_the_specified_type_then_getting_va
261261
{
262262
new Option(new[] { "-o", "--one" })
263263
{
264-
Argument = new Argument<int>((SymbolResult symbol, out int value) =>
264+
Argument = new Argument<int>((ArgumentResult symbol, out int value) =>
265265
{
266266
if (int.TryParse(symbol.Tokens.Select(t => t.Value).Single(), out value))
267267
{
@@ -674,7 +674,7 @@ public void When_custom_converter_is_specified_and_an_argument_is_of_the_wrong_t
674674
{
675675
var command = new Command("tally")
676676
{
677-
new Argument<int>((SymbolResult symbolResult, out int value) =>
677+
new Argument<int>((ArgumentResult symbolResult, out int value) =>
678678
{
679679
value = default;
680680
symbolResult.ErrorMessage = "Could not parse int";
@@ -698,7 +698,7 @@ public void When_custom_conversion_fails_then_an_option_does_not_accept_further_
698698
new Argument<string>(),
699699
new Option("-x")
700700
{
701-
Argument = new Argument<string>((SymbolResult symbolResult, out string value) =>
701+
Argument = new Argument<string>((ArgumentResult symbolResult, out string value) =>
702702
{
703703
value = null;
704704
return false;

src/System.CommandLine/Argument.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ internal TryConvertArgument ConvertArguments
6464
if (Arity.MaximumNumberOfValues == 1 &&
6565
ArgumentType == typeof(bool))
6666
{
67-
_convertArguments = (SymbolResult symbol, out object value) =>
67+
_convertArguments = (ArgumentResult symbol, out object value) =>
6868
{
6969
value = ArgumentConverter.ConvertObject(
7070
this,

src/System.CommandLine/Argument{T}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public Argument(TryConvertArgument<T> convert, Func<T> getDefaultValue = default
4545
throw new ArgumentNullException(nameof(convert));
4646
}
4747

48-
ConvertArguments = (SymbolResult result, out object value) =>
48+
ConvertArguments = (ArgumentResult result, out object value) =>
4949
{
5050
if (convert(result, out var valueObj))
5151
{

src/System.CommandLine/Binding/TryConvertArgument.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55

66
namespace System.CommandLine.Binding
77
{
8-
public delegate bool TryConvertArgument(SymbolResult symbolResult, out object value);
8+
public delegate bool TryConvertArgument(
9+
ArgumentResult symbolResult,
10+
out object value);
911

10-
public delegate bool TryConvertArgument<T>(SymbolResult symbolResult, out T value);
11-
}
12+
public delegate bool TryConvertArgument<T>(
13+
ArgumentResult symbolResult,
14+
out T value);
15+
}

0 commit comments

Comments
 (0)