You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to add a --help flag with optflag and a required option.
I expected my_command --help worked, but it didn't because Options::parse() failed due to the lack of the required option.
letmut opts = Options::new();
opts.optflag("h","help","Description");
opts.reqopt("r","required","Description","TEST");let result = opts.parse(&["--help"]);// Failed with "Required option 'required' missing"!assert!(result.is_ok());
So, how about have a method to add a help flag, which is an optional and makes parse() work without a required options if it's passed?
letmut opts = Options::new();
opts.helpflag("Description");
opts.reqopt("r","required","Description","TEST");let result = opts.parse(&["--help"]);assert!(result.is_ok());
The text was updated successfully, but these errors were encountered:
I tried to add a
--help
flag withoptflag
and a required option.I expected
my_command --help
worked, but it didn't becauseOptions::parse()
failed due to the lack of the required option.So, how about have a method to add a help flag, which is an optional and makes
parse()
work without a required options if it's passed?The text was updated successfully, but these errors were encountered: