forked from dotnet/command-line-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
33 lines (28 loc) · 961 Bytes
/
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
28
29
30
31
32
33
using System;
using System.CommandLine;
using System.CommandLine.Builder;
using System.CommandLine.Invocation;
using System.CommandLine.Parsing;
using System.Threading.Tasks;
namespace EndToEndTestApp
{
public class Program
{
static async Task Main(string[] args)
{
var rootCommand = new RootCommand
{
new Option<string>("--apple" ),
new Option<string>("--banana"),
new Option<string>("--cherry"),
new Option<string>("--durian")
};
rootCommand.Handler = CommandHandler.Create(typeof(Program).GetMethod(nameof(Run)));
var commandLine = new CommandLineBuilder(rootCommand)
.UseDefaults()
.Build();
await commandLine.InvokeAsync(args);
}
public static Task Run(string apple, string banana, string cherry, string durian) => Task.CompletedTask;
}
}