-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathProgram.cs
More file actions
46 lines (37 loc) · 1.2 KB
/
Program.cs
File metadata and controls
46 lines (37 loc) · 1.2 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
using System.Reflection;
using Spectre.Console;
namespace termix;
public static class Program
{
public static Task Main(string[] args)
{
if (args.Contains("--version") || args.Contains("-v"))
{
var informationalVersion = Assembly.GetEntryAssembly()?.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
var version = informationalVersion;
if (!string.IsNullOrEmpty(informationalVersion))
{
version = informationalVersion.Split('+')[0];
}
Console.WriteLine(version ?? "unknown");
return Task.CompletedTask;
}
var useIcons = !args.Contains("--no-icons");
try
{
AnsiConsole.Clear();
var fileManager = new FileManager(useIcons);
fileManager.Run();
AnsiConsole.Clear();
}
catch (Exception ex)
{
AnsiConsole.MarkupLine($"{ex.GetType().Name}: [red]{ex.Message}[/]");
if (!string.IsNullOrEmpty(ex.StackTrace))
{
AnsiConsole.WriteLine(ex.StackTrace);
}
}
return Task.CompletedTask;
}
}