-
Notifications
You must be signed in to change notification settings - Fork 3
/
Program.cs
55 lines (47 loc) · 1.67 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
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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Diagnostics;
using System.Linq;
using Microsoft.AspNetCore.SignalR.Crankier.Commands;
using Microsoft.Extensions.CommandLineUtils;
namespace Microsoft.AspNetCore.SignalR.Crankier
{
public class Program
{
public static void Main(string[] args)
{
#if DEBUG
if (args.Any(a => string.Equals(a, "--debug", StringComparison.Ordinal)))
{
args = args.Where(a => !string.Equals(a, "--debug", StringComparison.Ordinal)).ToArray();
Console.WriteLine($"Waiting for debugger. Process ID: {Process.GetCurrentProcess().Id}");
Console.WriteLine("Press ENTER to continue");
Console.ReadLine();
}
#endif
var app = new CommandLineApplication();
app.Description = "Crank's Revenge";
app.HelpOption("-h|--help");
LocalCommand.Register(app);
AgentCommand.Register(app);
WorkerCommand.Register(app);
ServerCommand.Register(app);
app.Command("help", cmd =>
{
var commandArgument = cmd.Argument("<COMMAND>", "The command to get help for.");
cmd.OnExecute(() =>
{
app.ShowHelp(commandArgument.Value);
return 0;
});
});
app.OnExecute(() =>
{
app.ShowHelp();
return 0;
});
app.Execute(args);
}
}
}