예제 #1
0
        public static int Main(string[] args)
        {
            var container = ContainerRegistration.Init();

            var app = new CommandLineApplication <Program> {
                ThrowOnUnexpectedArgument = false
            };

            app.Conventions.UseDefaultConventions().UseConstructorInjection(container);

            try
            {
                return(app.Execute(args));
            }
            catch (CommandParsingException cpe)
            {
                Console.WriteLine(cpe.Message);
                return((int)ExitCodes.InvalidArguments);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return((int)ExitCodes.UnknownError);
            }
        }
예제 #2
0
        public static async Task <int> Main(string[] args)
        {
            var container = ContainerRegistration.Init();

            var app = new CommandLineApplication <Program> {
                UnrecognizedArgumentHandling = UnrecognizedArgumentHandling.StopParsingAndCollect
            };

            app.Conventions.UseDefaultConventions().UseConstructorInjection(container);

            try
            {
                return(await app.ExecuteAsync(args));
            }
            catch (CommandParsingException cpe)
            {
                Console.WriteLine(cpe.Message);
                return((int)ExitCodes.InvalidArguments);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return((int)ExitCodes.UnknownError);
            }
        }
예제 #3
0
        public static async Task <int> Main(string[] args)
        {
            var settings = SettingsParser.ReadSettings(args);

            if (settings == null)
            {
                Console.WriteLine("Exiting early...");
                return(1);
            }

            var container = ContainerRegistration.Init(settings);
            var engine    = container.GetInstance <GithubEngine>();
            await engine.Run();

            return(0);
        }