JasperFx/oakton

Mandatory arguments

reegeek opened this issue · 2 comments

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.

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.

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