-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
44 lines (36 loc) · 1.14 KB
/
Program.cs
File metadata and controls
44 lines (36 loc) · 1.14 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
using System.CommandLine;
using System.CommandLine.Builder;
using System.CommandLine.Parsing;
namespace ModShardUnpacker;
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");
Option<string?> outputOption = new("--output")
{
Description = "Output folder."
};
outputOption.AddAlias("-o");
outputOption.SetDefaultValue(null);
RootCommand rootCommand = new("A CLI tool to pack mod source from MSL.")
{
nameOption,
outputOption,
};
rootCommand.SetHandler(MainOperations.MainCommand, nameOption, outputOption);
CommandLineBuilder commandLineBuilder = new(rootCommand);
commandLineBuilder.AddMiddleware(async (context, next) =>
{
await next(context);
});
commandLineBuilder.UseDefaults();
Parser parser = commandLineBuilder.Build();
await parser.InvokeAsync(args);
}
}