Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: .NotNull() check for command options #97

Open
agracio opened this issue Feb 21, 2018 · 0 comments
Open

Feature request: .NotNull() check for command options #97

agracio opened this issue Feb 21, 2018 · 0 comments

Comments

@agracio
Copy link

agracio commented Feb 21, 2018

It would be great if both required and optional options could be marked as NotNull with parser throwing exception if empty value is passed. The check should work for any object type, not only strings.
Example

var p = new FluentCommandLineParser<ApplicationArguments>();

   p.Setup(arg => arg.RecordId)
    .As('r', "record") 
    .Required(); 

   p.Setup(arg => arg.NewValue)
    .As('v', "value")
    .Required().NotNull(); // <- ensures that -v|--value is not empty

   p.Setup(arg => arg.Silent)
    .As('s', "silent")
    .SetDefault(false);

Current implementation allows command line to have ---value without any actual value so 'not null or empty' checks need be done separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant