-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
67 lines (58 loc) · 1.64 KB
/
Copy pathProgram.cs
File metadata and controls
67 lines (58 loc) · 1.64 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System.Text;
using CsAgentUI.Presentation.LeanUI;
using CsAgentUI.Presentation.Tui;
using CsAgentUI.Presentation.Web;
using CsAgentUI.Shared;
namespace CsAgentUI;
public static class Program
{
public const string Version = "0.5.1";
[STAThread]
public static int Main(string[] args)
{
// Ensure the console can render Unicode visual characters (✓, ⚠, →, box
// drawing, etc.). On Windows the default legacy code page (CP437/CP850)
// cannot display these; UTF-8 is required. Safe no-op on Unix terminals.
try
{
Console.OutputEncoding = Encoding.UTF8;
}
catch
{
// Some hosts (e.g. redirected output) may reject this; fall back to
// the default encoding rather than crashing.
}
var parsed = ArgumentParser.Parse(args);
if (parsed.ShowHelp)
{
HelpDisplay.Show(Version);
return 0;
}
if (parsed.ShowVersion)
{
Console.WriteLine($"CSAgent version {Version}");
return 0;
}
if (parsed.ShowDoc)
{
DocDisplay.Show();
return 0;
}
if (parsed.IsLeanUiMode)
{
// Lean UI mode - lightweight duplicate of the Web UI
LeanUIHost.Run(parsed);
}
else if (parsed.IsUiMode)
{
// Web UI mode - ASP.NET server with SSE
WebHost.Run(parsed);
}
else
{
// Default: Terminal UI mode
TuiHost.RunAsync(parsed).GetAwaiter().GetResult();
}
return 0;
}
}