jpdillingham / Utility.CommandLine.Arguments

A C# .NET class library containing tools for parsing the command line arguments of console applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Breaking changes for v6.0.0

jpdillingham opened this issue · comments

The existing Parse() has been replaced with three overloads.

Old:

public static Arguments Parse(string commandLineString = default(string), Type type = null, [CallerMemberName] string caller = default(string)) {}

New:

public static Arguments Parse(Action<ArgumentParseOptions> configure = null) {}
public static Arguments Parse(string commandLineString, Action<ArgumentParseOptions> configure = null) {}
public static Arguments Parse(string commandLineString, ArgumentParseOptions options) {}

The caller argument wasn't doing anything in the first place, and the type argument is now specified through the TargetType property of ArgumentParseOptions.

ArgumentParseOptions contains the following properties:

  • TargetType -- same functionality as the previous type parameter
  • CombineAllMultiples -- combines repeated argument values into a list
  • CombinableArguments -- if CombineAllMultiples is false, combines the specified arguments into a list
    If TargetType is supplied and repeated arguments match a property in the type, the behavior remains the same; if the backing type of the property is a collection, values are combined, otherwise they are overwritten.

If TargetType is not supplied, or repeated arguments don't match a property in the type, the behavior depends on the other options for multiples, either everything or just those specified.