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

Pass additional parameters into Required() for conditional requirements #111

Open
SCLDGit opened this issue Feb 25, 2021 · 0 comments
Open

Comments

@SCLDGit
Copy link

SCLDGit commented Feb 25, 2021

It would be nice to be able to mark some additional into into the Required() field, such that a parameter is only required if some other criteria are met. An example would be only requiring a password to be input if a user name has also been used as an argument. Something like:

parser.Setup(p_arg => p_arg.UserName)
                .As('u', "user")
                .WithDescription("The user name to use for login.");

 parser.Setup(p_arg => p_arg.UserPassword)
                .As('p', "password")
                .WithDescription("The user password to use for login.")
                .Required(p_otherArgs => !string.IsNullOrWhitespace(p_otherArgs.UserName));
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