using System.Collections.Generic;
public static void Main()
var args ="--help".Split();
static void StartUp(string[] args)
var parser = new CommandLine.Parser(with=> with.HelpWriter=null);
var parserResult = parser.ParseArguments<Options>(args);
.WithParsed<Options>(options => Run(options))
.WithNotParsed(errs=> DisplayHelp(parserResult,errs));
static void DisplayHelp<T>(ParserResult<T> result,IEnumerable< Error> errs)
var helpText= HelpText.AutoBuild(result, h =>
h.AdditionalNewLineAfterOption=false;
h.Heading ="Myapp 2.0.0-beta";
h.Copyright="Copyright (c) 2019 Global.com";
return HelpText.DefaultParsingErrorsHandler(result, h);
Console.WriteLine(helpText);
static void Run(Options options)
[Option('r', "read", Required = false, HelpText = "Input files to be processed.")]
public IEnumerable<string> InputFiles { get; set; }
HelpText = "Prints all messages to standard output.")]
public bool Verbose { get; set; }
HelpText = "Read from stdin")]
public bool stdin { get; set; }
[Value(0, MetaName = "offset", HelpText = "File offset.")]
public long? Offset { get; set; }