-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathProgram.cs
27 lines (24 loc) · 1.04 KB
/
Program.cs
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
using Ookii.CommandLine;
using Ookii.CommandLine.Commands;
namespace NestedCommands;
internal static class Program
{
static async Task<int> Main()
{
var options = new CommandOptions()
{
// For the top-level, we only want commands that don't have the ParentCommandAttribute.
CommandFilter = (command) => !Attribute.IsDefined(command.CommandType, typeof(ParentCommandAttribute)),
UsageWriter = new UsageWriter()
{
// Add the application description.
IncludeApplicationDescriptionBeforeCommandList = true,
// Commands with child commands don't technically have a -Help argument, but they'll
// ignore it and print their child command list anyway, so let's show the message.
IncludeCommandHelpInstruction = true,
},
};
var manager = new CommandManager(options);
return await manager.RunCommandAsync() ?? (int)ExitCode.CreateCommandFailure;
}
}