Exemplo n.º 1
0
        public static int Main(string[] args)
        {
            try
            {
                var services = new ServiceCollection()
                               .AddCSharpToTypeScript()
                               .BuildServiceProvider();

                using (var cli = new CommandLineApplication <ConvertCommand>())
                {
                    cli.Conventions.UseDefaultConventions()
                    .UseConstructorInjection(services);

                    return(cli.Execute(args));
                }
            }
#pragma warning disable CS0168
            catch (Exception ex)
            {
#if RELEASE
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Error.WriteLine(string.Join(" ---> ", ExceptionMessage.Flatten(ex).Distinct()));
                Console.ResetColor();

                return(1);
#else
                throw;
#endif
            }
        }