j-maly / CommandLineParser

Command line parser. Declarative arguments support. Rich set of argument types (switches, enums, files, etc...). Mutually exclusive arguments validations.
MIT License
137 stars 30 forks source link

Default value for non-existing argument #55

Closed YauhenPyl closed 5 years ago

YauhenPyl commented 6 years ago

Hello, thank you for the great library.

Is it possible to set different default values for ValueArgument if it is passed but without any value and if it is not passed at all? E.g.

internal class Arguments
{
    [ValueArgument(typeof(string), 'a', "argument", ValueOptional = true, DefaultValueNonExisting = "", DefaultValue = null, Optional = true)]
    public string Value { get; set; }
}

Thanks

j-maly commented 6 years ago

Hi, it could be added but I can't give you any ETA atm. If you don't want to implement it yourself...

As a workaround, you could

eapyl commented 6 years ago

Added quick implementation for this idea.

alexandre-lecoq commented 5 years ago

This was implemented. Issue can be closed.