CommandLineUtils icon indicating copy to clipboard operation
CommandLineUtils copied to clipboard

[Question] how do I make an option mandatory?

Open mattfrear opened this issue 5 years ago • 3 comments

The documentation says that options can be made mandatory, but I can't see an example of how to do that.

I thought that maybe [Option(CommandOptionType.SingleValue)] would do this, but it doesn't.

mattfrear avatar Mar 24 '20 20:03 mattfrear

Here is a sample. This should probably be explicitly called out in the docs, too. https://github.com/natemcmaster/CommandLineUtils/blob/7281ee9fef08286a3a0a4f72d04b1d234747b316/docs/samples/validation/attributes/Program.cs#L14-L16

natemcmaster avatar Mar 27 '20 14:03 natemcmaster

Oh, that's easy! Thanks. I even went searching in here for Required and couldn't see it, cos that's the wrong place.

https://natemcmaster.github.io/CommandLineUtils/v2.5/api/McMaster.Extensions.CommandLineUtils.OptionAttribute.html

mattfrear avatar Mar 27 '20 17:03 mattfrear

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please comment if you believe this should remain open, otherwise it will be closed in 14 days. Thank you for your contributions to this project.

stale[bot] avatar Jul 21 '21 02:07 stale[bot]

This issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please comment if you believe this should remain open, otherwise it will be closed in 14 days. Thank you for your contributions to this project.

github-actions[bot] avatar Nov 14 '22 02:11 github-actions[bot]

Closing due to inactivity. If you are looking at this issue in the future and think it should be reopened, please make a commented here and mention natemcmaster so he sees the notification.

github-actions[bot] avatar Nov 29 '22 02:11 github-actions[bot]