natemcmaster / CommandLineUtils

Command line parsing and utilities for .NET

Home Page:https://natemcmaster.github.io/CommandLineUtils/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] how do I make an option mandatory?

mattfrear opened this issue · 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.

Here is a sample. This should probably be explicitly called out in the docs, too.

[Required]
[Option(Description = "Required. The message")]
private string Message { get; }

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

commented

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.

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.

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.