gsscoder/commandline — pull request #39 by mizipzor (2013-01-09 22:01:07+00:00)
Title: Added ResourcedOptionAttribute.

This allows users to move all option help text into resources. I experimented a while with getting a ```ResourceManager``` from ```Assembly.GetEntryAssembly()```, but it was tricky to get generic enough. And explicit is better than implicit.

Here's an example on how to use it:

```
class Program
{
private class Options : CommandLineOptionsBase
{
public Options()
{
// Could be replaced with some logic
// selecting other (localized) resources
ResourcedOptionAttribute.ResourceManager =
Properties.Resource1.ResourceManager;
}

[ResourcedOption(null, "foo", Required = true,
HelpTextKey = "FooHelpText")]
public string Foo { get; set; }

[HelpOption]
public string GetUsage()
{
return HelpText.AutoBuild(this, current =>
HelpText.DefaultParsingErrorsHandler(this, current));
}
}

static void Main(string[] args)
{
var options = new Options();
if (!CommandLineParser.Default.ParseArguments(args, options))
{
Environment.Exit(-1);
}
}
}
```