-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
38 lines (30 loc) · 916 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
using System;
using CommandLine;
using CommandLine.Text;
using System.Configuration;
using SpLib;
using System.IO;
namespace SpConsole
{
class Program
{
static void Main(string[] args)
{
var helpWriter = new StringWriter();
var parser = new CommandLine.Parser(with => with.HelpWriter = helpWriter);
var result = parser.ParseArguments<FindOptions, UploadOptions, DownloadOptions, ExecOptions>(args)
.WithParsed(options=> ProcessOptions(options))
.WithNotParsed(
errs =>
Console.WriteLine(helpWriter.ToString()));
}
static void ProcessOptions(object obj)
{
if (obj is Options options)
{
var cr = new CommandRunner(options);
cr.Run();
}
}
}
}