Skip to content

Instantly share code, notes, and snippets.

@alexanderfast
Created November 30, 2012 14:30
Show Gist options
  • Save alexanderfast/4176096 to your computer and use it in GitHub Desktop.
Save alexanderfast/4176096 to your computer and use it in GitHub Desktop.
CommandLine issue 15
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