|
1 | 1 | using System; |
2 | 2 | using System.Collections.Generic; |
3 | | -using System.Linq; |
4 | | -using System.Text; |
5 | | -using System.Threading.Tasks; |
6 | 3 | using CommandLine; |
7 | 4 | using CommandLine.Text; |
8 | 5 |
|
9 | 6 | namespace CacheInitializer |
10 | 7 | { |
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 | + } |
53 | 47 | } |
0 commit comments