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

Mandatory arguments #73

Open
reegeek opened this issue Dec 13, 2022 · 2 comments
Open

Mandatory arguments #73

reegeek opened this issue Dec 13, 2022 · 2 comments
Labels

Comments

@reegeek
Copy link

reegeek commented Dec 13, 2022

Hi,
First of all, thank for sharing your project.

It is possible to mark some arguments as mandatory ?

mandatory in the sense that if they are missing then we have an error.

@mysticmind
Copy link
Member

mysticmind commented Dec 14, 2022

I think by default it is mandatory. Only if your property name has a Flag suffix, it is treated as optional. Please check and revert.

@reegeek
Copy link
Author

reegeek commented Dec 14, 2022

Indeed Flag are optional.
I have just modify quick start example by:

 public class NameInput
    {
        [Description("The name to be printed to the console output")]
        public string Name { get; set; }

        [Description("The name to be printed to the console output")]
        public string Name2 { get; set; }
        
        [Description("The color of the text. Default is black")]
        public ConsoleColor ColorFlag { get; set; } = ConsoleColor.Black;

        [Description("Optional title preceeding the name")]
        public string TitleFlag { get; set; }
    }

Name and Name2 are mandatories but I cannot set Name2.
Following syntax not working:
dotnet run -- name titi toto -c Red

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

No branches or pull requests

2 participants