Skip to content

Instantly share code, notes, and snippets.

@gsscoder
Created January 24, 2013 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gsscoder/4625139 to your computer and use it in GitHub Desktop.
Save gsscoder/4625139 to your computer and use it in GitHub Desktop.
Command Line Parser, verbs GetUsage.
class Options : CommandLineOptionsBase
{
// option attributes as above...
[HelpVerbOption]
public string GetUsage(string verb)
{
bool found;
var instance = (CommandLineOptionsBase) CommandLineParser.GetVerbOptionsInstanceByName(verb, this, out found);
var verbsIndex = verb == null || !found;
var target = verbsIndex ? this : instance;
return HelpText.AutoBuild(target, current => HelpText.DefaultParsingErrorsHandler(target, current), verbsIndex);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment