You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In version 1.4.3, FluentCommandLineParser<TBuildType> requires that TBuildType provides public parameterless constructor, using new() generic parameter constraint. Will be nice to have a way to use arguments object without public parameterless constructor. For instance, by introducing FluentCommandLineParser<TBuildType> constructor overload, which accepts Action<TBuildType> factory method. It can be used to better argument object incapsulation, by prohibiting its creation outside of argument object factory method. For example:
internal class StartupArguments
{
public bool Argument1 { get; private set; }
public bool Argument2 { get; private set; }
public bool HelpCalled { get; set; }
// I can't do it private now :(
private StartupArguments()
{
}
public static StartupArguments Parse(string[] args)
{
// Just creates arguments object
var parser = new FluentCommandLineParser<StartupArguments>(() => new StartupArguments());
// Setup here
var parsingResult = parser.Parse(args);
parser.Object.HelpCalled = parsingResult.HelpCalled;
return parser.Object;
}
}
Lovely lib, mate 👍
The text was updated successfully, but these errors were encountered:
In version 1.4.3,
FluentCommandLineParser<TBuildType>
requires thatTBuildType
provides public parameterless constructor, usingnew()
generic parameter constraint. Will be nice to have a way to use arguments object without public parameterless constructor. For instance, by introducingFluentCommandLineParser<TBuildType>
constructor overload, which acceptsAction<TBuildType>
factory method. It can be used to better argument object incapsulation, by prohibiting its creation outside of argument object factory method. For example:Lovely lib, mate 👍
The text was updated successfully, but these errors were encountered: