Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
replace ParseArgument<T> with Func<ArgumentResult, T>, fixes #1939
  • Loading branch information
adamsitnik committed Nov 4, 2022
commit 869b25060b0fafac73a03d856e9d4740b076ea98
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ System.CommandLine
.ctor(System.String name, System.String description = null)
.ctor(System.String name, Func<T> getDefaultValue, System.String description = null)
.ctor(Func<T> getDefaultValue)
.ctor(System.String name, ParseArgument<T> parse, System.Boolean isDefault = False, System.String description = null)
.ctor(ParseArgument<T> parse, System.Boolean isDefault = False)
.ctor(System.String name, Func<System.CommandLine.Parsing.ArgumentResult,T> parse, System.Boolean isDefault = False, System.String description = null)
.ctor(Func<System.CommandLine.Parsing.ArgumentResult,T> parse, System.Boolean isDefault = False)
public System.Type ValueType { get; }
public struct ArgumentArity : System.ValueType, System.IEquatable<ArgumentArity>
public static ArgumentArity ExactlyOne { get; }
Expand Down Expand Up @@ -202,8 +202,8 @@ System.CommandLine
public class Option<T> : Option, IValueDescriptor<T>, System.CommandLine.Binding.IValueDescriptor, System.CommandLine.Completions.ICompletionSource
.ctor(System.String name, System.String description = null)
.ctor(System.String[] aliases, System.String description = null)
.ctor(System.String name, ParseArgument<T> parseArgument, System.Boolean isDefault = False, System.String description = null)
.ctor(System.String[] aliases, ParseArgument<T> parseArgument, System.Boolean isDefault = False, System.String description = null)
.ctor(System.String name, Func<System.CommandLine.Parsing.ArgumentResult,T> parseArgument, System.Boolean isDefault = False, System.String description = null)
.ctor(System.String[] aliases, Func<System.CommandLine.Parsing.ArgumentResult,T> parseArgument, System.Boolean isDefault = False, System.String description = null)
.ctor(System.String name, Func<T> getDefaultValue, System.String description = null)
.ctor(System.String[] aliases, Func<T> getDefaultValue, System.String description = null)
public ArgumentArity Arity { get; set; }
Expand Down Expand Up @@ -417,11 +417,6 @@ System.CommandLine.Parsing
public Token Token { get; }
public System.Object GetValueOrDefault()
public T GetValueOrDefault<T>()
public delegate ParseArgument<out T> : System.MulticastDelegate, System.ICloneable, System.Runtime.Serialization.ISerializable
.ctor(System.Object object, System.IntPtr method)
public System.IAsyncResult BeginInvoke(ArgumentResult result, System.AsyncCallback callback, System.Object object)
public T EndInvoke(System.IAsyncResult result)
public T Invoke(ArgumentResult result)
public class ParseError
public System.String Message { get; }
public SymbolResult SymbolResult { get; }
Expand Down
4 changes: 2 additions & 2 deletions src/System.CommandLine/Argument{T}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public Argument(Func<T> getDefaultValue) : this()
/// <exception cref="ArgumentNullException">Thrown when <paramref name="parse"/> is null.</exception>
public Argument(
string? name,
ParseArgument<T> parse,
Func<ArgumentResult, T> parse,
bool isDefault = false,
string? description = null) : this(name, description)
{
Expand Down Expand Up @@ -108,7 +108,7 @@ public Argument(
/// </summary>
/// <param name="parse">A custom argument parser.</param>
/// <param name="isDefault"><see langword="true"/> to use the <paramref name="parse"/> result as default value.</param>
public Argument(ParseArgument<T> parse, bool isDefault = false) : this(null!, parse, isDefault)
public Argument(Func<ArgumentResult, T> parse, bool isDefault = false) : this(null!, parse, isDefault)
{
}

Expand Down
4 changes: 2 additions & 2 deletions src/System.CommandLine/Option{T}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public Option(
/// <inheritdoc/>
public Option(
string name,
ParseArgument<T> parseArgument,
Func<ArgumentResult, T> parseArgument,
bool isDefault = false,
string? description = null)
: base(name, description,
Expand All @@ -37,7 +37,7 @@ public Option(
/// <inheritdoc/>
public Option(
string[] aliases,
ParseArgument<T> parseArgument,
Func<ArgumentResult, T> parseArgument,
bool isDefault = false,
string? description = null)
: base(aliases, description, new Argument<T>(parseArgument ?? throw new ArgumentNullException(nameof(parseArgument)), isDefault))
Expand Down
13 changes: 0 additions & 13 deletions src/System.CommandLine/Parsing/ParseArgument{T}.cs

This file was deleted.