-
Notifications
You must be signed in to change notification settings - Fork 481
Could two or more options be marked as 'at least one is required'? #546
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
Comments
You can use Mutually Exclusive Options. [Verb("rename")]
public sealed class RenameOptions
{
[Option("prefix", HelpText = "Prefix to append to file name", SetName = "prefix", Required = true)]
public string Prefix { get; set; }
[Option("suffix", HelpText = "Suffix to append to file name", SetName = "suffix", Required = true)]
public string Suffix { get; set; }
} This is working:
This is not working
For more details about Mutually Exclusive Options see wiki |
Hello, I actually am trying to do the following
I hope this makes sense. |
it should not work. |
I removed the SetName completely. I am trying to make it work like the example from my previous comment |
I created a PR #552 which solves this issue. It is still "work in progress" so I am open to any suggestions about it. |
@moh-hassan please close this issue |
Thanks, closed |
Hello,
This is not particularly an issue. I was wondering could I make two or more options to act like at least one of them is required, but if none is provided I will get a required error?
This works if both options are included. Could I make them to work separately or together, but always one should be provided?
The text was updated successfully, but these errors were encountered: