-
-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathProgram.cs
More file actions
21 lines (15 loc) · 700 Bytes
/
Program.cs
File metadata and controls
21 lines (15 loc) · 700 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using System.CommandLine;
using BullseyeSmokeTester.CommandLine;
using static Bullseye.Targets;
var foo = new Option<string>("--foo", "-f") { Description = "A value used for something.", };
var targets = Argument.Targets();
var options = IEnumerable<Option>.Bullseye().ToList();
var cmd = new RootCommand { foo, targets, };
cmd.AddOptions(options);
cmd.SetAction(async cmdLine =>
{
Target("build", () => Console.Out.WriteLineAsync($"{nameof(foo)} = {cmdLine.GetValue(foo)}"));
Target("default", dependsOn: ["build",]);
await RunTargetsAndExitAsync(cmdLine.GetRequiredValue(targets), cmdLine.GetOptions(options));
});
return await cmd.Parse(args).InvokeAsync();