This repository has been archived by the owner on Dec 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
45 lines (36 loc) · 1.5 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
using CommandLine;
namespace ImportAPIClient
{
class Program
{
public class Options
{
[Option('s', "HTTPS", Required = false, Default = true,
HelpText = "Pass true if the API server scheme is https.")]
public bool? IsHttps { get; set; }
[Option('h', "host", Required = true,
HelpText = "API server host")]
public string Host { get; set; }
[Option('p', "port", Required = true,
HelpText = "API server port")]
public int Port { get; set; }
[Option('t', "token", Required = true,
HelpText = "API server authorization token")]
public string Token { get; set; }
[Option('v', "version", Required = false, Default = "v1.0",
HelpText = "API version")]
public string Version { get; set; }
}
static void Main(string[] args)
{
Util.NLogConfig.ConfigureToConsole();
Parser.Default.ParseArguments<Options>(args).WithParsed<Options>(RunOptionsAndReturnExitCode);
}
private static void RunOptionsAndReturnExitCode(Options opts)
{
Client.ImportAPIClient client = new Client.ImportAPIClient(opts.Host, opts.Port, opts.Token, opts.IsHttps == true, opts.Version);
Manager.ImportManager importManager = new Manager.ImportManager(new Repo.MockedCaseRepo(), client);
importManager.ImportAllCasesAndEvents();
}
}
}