Getting Help to work

Aug 15, 2013 at 11:52 AM
I'm really struggling to get a feel for what the expected behaviour is for error handling/help text rendering, and even more with getting the help options/verb options to work as I expect it to.

To me there are distinct scenarios:

These should all return the VerbOption-level help screen - no errors.
app help
app --help
app hepl or app fish should return something like
"ehpl is not a valid command. See app --help."
This can be with or without the VerbOption-level help screen afterwards (e.g. git doesn't do this, ipconfig does...). Whatever the default decides!

At the moment, it looks like there's no difference between AutoBuild finding the help verb, an invalid verb or no verb.

These should return the Option-level help screen with no errors

app save --help
and ideally
app save -?

When I say "no errors", I mean no "violates required" or "violates format" for the arguments under save that are omitted.

These should show an error message and the Option-level help screen:
Assuming two options under save:
-p --path .................... string Required
-o --overwrite ........... bool
app save -o       // violates required for -p
app save -p       // no string passed for -p
app save -p "C:\Temp1.txt" "C:\Temp2.txt" // too many strings passed to -p
app save -y       // undefined option
app save --hepl // mistyped "help"
and possibly several other combinations.

**These are my expectations of the default. Are my "expectations" wrong and if so, do I need some custom implementation? And how?**
  • I am using the current stable release
  • My Parser has IgnoreUnknownArguments set to false
  • I create instances of the SubOptions in the Options ctor
  • I have added IParserState LastParserState at VerbOption and SubOption level
  • I have implemented GetUsage(string) only at Verb level
  • In GetUsage I just call HelpText.AutoBuild(this, verb);
Will add full source code in comments if needed, but this is already too long!