Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Commit 3d8ff7b

Browse files
committed
dotnetcore migration part 2 of 2
1 parent 2776d02 commit 3d8ff7b

File tree

2 files changed

+213
-212
lines changed

2 files changed

+213
-212
lines changed

ParamHandler.cs

Lines changed: 39 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,47 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
63
using CommandLine;
74
using CommandLine.Text;
85

96
namespace CacheInitializer
107
{
11-
// Define a class to receive parsed values
12-
class Options
13-
{
14-
15-
[Option('s', "server", Required = true,
16-
HelpText = "URL to the server.")]
17-
public string server { get; set; }
18-
19-
[Option('a', "appname", Required = false,
20-
HelpText = "App to load (using app name)")]
21-
public string appname { get; set; }
22-
23-
[Option('i', "appid", Required = false,
24-
HelpText = "App to load (using app ID)")]
25-
public string appid { get; set; }
26-
27-
[Option('p', "proxy", Required = false,
28-
HelpText = "Virtual Proxy to use")]
29-
public string virtualProxy { get; set; }
30-
31-
[Option('o', "objects", Required = false, DefaultValue = false,
32-
HelpText = "cycle through all sheets and objects")]
33-
public bool fetchobjects { get; set; }
34-
35-
[Option('f', "field", Required = false,
36-
HelpText = "field to make selections in e.g Region")]
37-
public string selectionfield { get; set; }
38-
39-
[Option('v', "values", Required = false,
40-
HelpText = "values to select e.g \"France\",\"Germany\",\"Spain\"")]
41-
public string selectionvalues { get; set; }
42-
43-
[ParserState]
44-
public IParserState LastParserState { get; set; }
45-
46-
[HelpOption]
47-
public string GetUsage()
48-
{
49-
return HelpText.AutoBuild(this,
50-
(HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current));
51-
}
52-
}
8+
// Define a class to receive parsed values
9+
class Options
10+
{
11+
12+
[Option('s', "server", Required = true,
13+
HelpText = "URL to the server.")]
14+
public string server { get; set; }
15+
16+
[Option('a', "appname", Required = false,
17+
HelpText = "App to load (using app name)")]
18+
public string appname { get; set; }
19+
20+
[Option('i', "appid", Required = false,
21+
HelpText = "App to load (using app ID)")]
22+
public string appid { get; set; }
23+
24+
[Option('p', "proxy", Required = false,
25+
HelpText = "Virtual Proxy to use")]
26+
public string virtualProxy { get; set; }
27+
28+
[Option('o', "objects", Required = false, Default = false,
29+
HelpText = "cycle through all sheets and objects")]
30+
public bool fetchobjects { get; set; }
31+
32+
[Option('f', "field", Required = false,
33+
HelpText = "field to make selections in e.g Region")]
34+
public string selectionfield { get; set; }
35+
36+
[Option('v', "values", Required = false,
37+
HelpText = "values to select e.g \"France\",\"Germany\",\"Spain\"")]
38+
public string selectionvalues { get; set; }
39+
40+
static void DisplayHelp<T>(ParserResult<T> result, IEnumerable<Error> errs)
41+
{
42+
var helpText = HelpText.AutoBuild(result,
43+
(current) => HelpText.DefaultParsingErrorsHandler(result, current));
44+
Console.WriteLine(helpText);
45+
}
46+
}
5347
}

0 commit comments

Comments
 (0)