forked from AdrianWilczynski/CSharpToTypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
47 lines (42 loc) · 1.25 KB
/
Copy pathProgram.cs
File metadata and controls
47 lines (42 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using CSharpToTypeScript.CLITool.Commands;
using CSharpToTypeScript.Core.DependencyInjection;
using McMaster.Extensions.CommandLineUtils;
using Microsoft.Extensions.DependencyInjection;
#if RELEASE
using System.Linq;
using CSharpToTypeScript.CLITool.Utilities;
#endif
namespace CSharpToTypeScript.CLITool
{
public static class Program
{
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
}
}
}
}