Link to home
Start Free TrialLog in
Avatar of itnifl
itniflFlag for Norway

asked on

commandline.codeplex.com required argumen except when displaying help

I am using this: https://commandline.codeplex.com/

For instance:
[Option('w', "warning", Required = true, HelpText = "Set the warning threshold in MB")]
public double WarningThreshold { get; set; }

[Option('c', "critical", Required = true, HelpText = "Set the critical threshold in MB")]
public double CriticalThreshold { get; set; }

[Option('h', "help", Required = false, HelpText = "Display help screen")]
public bool Help { get; set; }

Open in new window


Now both these arguments are needed for the commandline library to parse the arguments into an object I can use in C#.
Lets say I want to print the help screen. Naturally I don't supply the two arguments described above. Thus the commandline library never parses the arguments into an object, and the never to be objects Help boolean never gets set. I could just display the help screen every time the parsing of the arguments fail. But I wonder if there are any ways to have required arguments and then skip requiring them of for instance a specific argument is passed? That might be the --Help argument here.
ASKER CERTIFIED SOLUTION
Avatar of it_saige
it_saige
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of itnifl

ASKER

Got it, thanks