-
Notifications
You must be signed in to change notification settings - Fork 2
/
Program.cs
41 lines (36 loc) · 909 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
34
35
36
37
38
39
40
using System;
using System.ComponentModel;
// ReSharper disable UnusedMember.Global
namespace deniszykov.CommandLine.Example
{
[Description("This test application. Type /? for help.")]
public class Program
{
private static int Main(string[] arguments)
{
var exitCode = CommandLine
.CreateFromArguments(arguments)
.Configure(config =>
{
config.UnhandledExceptionHandler += (sender, args) => Console.Error.WriteLine(args.Exception.ToString());
})
.Use<Program>()
.Run();
return exitCode;
}
// ### Basic Verb ###
[Description("Says hello to specified 'name'.")]
public static int Hello(string name)
{
Console.WriteLine("Hello " + name + "!");
return 0;
}
// ### Sub Verb ###
[Description("Math related verbs.")]
public static int Math(ICommandLineBuilder subVerbBuilder)
{
return subVerbBuilder.Use<MathVerbs>()
.Run();
}
}
}