private static async Task InternalMain(string[] args, PackageHelper packageHelper) { // now uses 'verbs' so each verb is a command // // e.g umbpack init or umbpack push // // these are handled by the Command classes. var parser = new Parser(with => { with.HelpWriter = null; // with.HelpWriter = Console.Out; with.AutoVersion = false; with.CaseSensitive = false; }); // TODO: could load the verbs by interface or class var parserResults = parser.ParseArguments <PackOptions, PushOptions, InitOptions>(args); parserResults .WithParsed <PackOptions>(opts => PackCommand.RunAndReturn(opts).Wait()) .WithParsed <PushOptions>(opts => PushCommand.RunAndReturn(opts, packageHelper).Wait()) .WithParsed <InitOptions>(opts => InitCommand.RunAndReturn(opts)) .WithNotParsed(async errs => await DisplayHelp(parserResults, errs)); }