-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
70 lines (59 loc) · 1.99 KB
/
Program.cs
File metadata and controls
70 lines (59 loc) · 1.99 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
68
69
70
using System.CommandLine;
using System.CommandLine.Builder;
using System.CommandLine.Parsing;
namespace ModShardPacker;
internal static class Program
{
static async Task Main(string[] args)
{
Option<string> nameOption = new("--name")
{
Description = "Name of the output.",
IsRequired = false
};
nameOption.AddAlias("-n");
nameOption.SetDefaultValue(null);
Option<string> folderOption = new("--folder")
{
Description = "Folder of the mod code source.",
IsRequired = true
};
folderOption.AddAlias("-f");
Option<string?> outputOption = new("--output")
{
Description = "Output folder."
};
outputOption.AddAlias("-o");
outputOption.SetDefaultValue(null);
Option<string?> dllOption = new("--dll")
{
Description = "Folder where all dlls needed to compile are located.",
};
dllOption.AddAlias("-d");
dllOption.SetDefaultValue(null);
Option<bool> logOption = new("--is-verbose")
{
Description = "Enable log output into a log file in the cwd.",
Arity = ArgumentArity.Zero,
};
logOption.AddAlias("-v");
logOption.SetDefaultValue(false);
RootCommand rootCommand = new("A CLI tool to pack mod source from MSL.")
{
nameOption,
folderOption,
outputOption,
dllOption,
logOption
};
rootCommand.SetHandler(MainOperations.MainCommand, nameOption, folderOption, outputOption, dllOption, logOption);
CommandLineBuilder commandLineBuilder = new(rootCommand);
commandLineBuilder.AddMiddleware(async (context, next) =>
{
await next(context);
});
commandLineBuilder.UseDefaults();
Parser parser = commandLineBuilder.Build();
await parser.InvokeAsync(args);
}
}