public static int Main(string[] args) { DebugHelper.HandleDebugSwitch(ref args); try { var app = new CommandLineApplication <CommandLineOptions>(); app.ValueParsers.Add(new IPAddressParser()); app.Conventions.UseDefaultConventions(); app.OnExecute(async() => { var server = new SimpleServer(app.Model, PhysicalConsole.Singleton, Directory.GetCurrentDirectory()); return(await server.RunAsync()); }); return(app.Execute(args)); } catch (Exception ex) { Console.ForegroundColor = ConsoleColor.Red; Console.Error.WriteLine("Unexpected error: " + ex.ToString()); Console.ResetColor(); return(ERROR); } }
protected virtual Task <int> OnRunAsync(CommandLineOptions options, CancellationToken ct) { var server = new SimpleServer(options, PhysicalConsole.Singleton, Directory.GetCurrentDirectory()); return(server.RunAsync(ct)); }