Created
November 30, 2012 14:30
-
-
Save alexanderfast/4176096 to your computer and use it in GitHub Desktop.
CommandLine issue 15
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
using System; | |
using CommandLine; | |
using CommandLine.Text; | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ | |
private class Options : CommandLineOptionsBase | |
{ | |
[Option("z", "zzz")] | |
public int Test { get; set; } | |
[HelpOption] | |
public string GetUsage() | |
{ | |
return HelpText.AutoBuild( | |
this, | |
current => HelpText.DefaultParsingErrorsHandler(this, current)); | |
} | |
} | |
static void Main(string[] args) | |
{ | |
args = "".Split(); // prints true and no help text | |
args = "-z 0".Split(); // prints true and no help text | |
args = "-z".Split(); // prints false and help text, but no errors | |
Options options = new Options(); | |
Console.WriteLine(CommandLineParser.Default.ParseArguments(args, options)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment