Created
January 24, 2013 17:02
-
-
Save gsscoder/4625139 to your computer and use it in GitHub Desktop.
Command Line Parser, verbs GetUsage.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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