|
1 | 1 | using CommandLine;
|
2 |
| -using System; |
3 |
| -using System.IO; |
| 2 | +using System.Collections.Generic; |
4 | 3 |
|
5 |
| -namespace PT.PM.Cli |
| 4 | +namespace PT.PM.Cli.Common |
6 | 5 | {
|
7 | 6 | public class CliParameters
|
8 | 7 | {
|
| 8 | + [Option('c', "config", HelpText = "Json file with settings")] |
| 9 | + public string ConfigFile { get; set; } |
| 10 | + |
9 | 11 | [Option('f', "files", HelpText = "Input file or directory to be processed")]
|
10 |
| - public string InputFileNameOrDirectory { get; set; } = ""; |
| 12 | + public string InputFileNameOrDirectory { get; set; } |
11 | 13 |
|
12 |
| - [Option('l', "languages", HelpText = "Languages to be processed")] |
13 |
| - public string Languages { get; set; } = ""; |
| 14 | + [Option('l', "languages", HelpText = "Languages to be processed", Separator = ',')] |
| 15 | + public IEnumerable<string> Languages { get; set; } |
14 | 16 |
|
15 | 17 | [Option("patterns", HelpText = "Patterns to be processed")]
|
16 |
| - public virtual string Patterns { get; set; } = ""; |
| 18 | + public string Patterns { get; set; } |
17 | 19 |
|
18 |
| - [Option("pattern-ids", HelpText = "Pattern identifiers to be processed")] |
19 |
| - public string PatternIds { get; set; } = ""; |
| 20 | + [Option("pattern-ids", HelpText = "Pattern identifiers to be processed", Separator = ',')] |
| 21 | + public IEnumerable<string> PatternIds { get; set; } |
20 | 22 |
|
21 | 23 | [Option('t', "threads", HelpText = "Number of processing threads")]
|
22 |
| - public int ThreadCount { get; set; } = 1; |
| 24 | + public int? ThreadCount { get; set; } |
23 | 25 |
|
24 | 26 | [Option("not-preprocess-ust", HelpText = "Do not include ust simplification stage")]
|
25 |
| - public bool NotPreprocessUst { get; set; } = false; |
| 27 | + public bool? NotPreprocessUst { get; set; } |
26 | 28 |
|
27 | 29 | [Option('s', "stage", HelpText = "End processing stage. By default: Match")]
|
28 |
| - public string Stage { get; set; } = PM.Stage.Match.ToString(); |
| 30 | + public string Stage { get; set; } |
29 | 31 |
|
30 | 32 | [Option("max-stack-size", HelpText = "Thread stack size in bytes")]
|
31 |
| - public int MaxStackSize { get; set; } = 0; |
| 33 | + public uint? MaxStackSize { get; set; } |
32 | 34 |
|
33 | 35 | [Option('m', "memory", HelpText = "Approximate max memory consumption in megabytes")]
|
34 |
| - public int Memory { get; set; } = 300; |
| 36 | + public uint? Memory { get; set; } |
35 | 37 |
|
36 | 38 | [Option("timeout", HelpText = "Max spent time per file in seconds")]
|
37 |
| - public int FileTimeout { get; set; } = 0; |
| 39 | + public uint? FileTimeout { get; set; } |
38 | 40 |
|
39 | 41 | [Option("logs-dir", HelpText = "Logs directory")]
|
40 |
| - public string LogsDir { get; set; } = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)); |
| 42 | + public string LogsDir { get; set; } |
41 | 43 |
|
42 | 44 | [Option("temp-dir", HelpText = "Temp directory")]
|
43 |
| - public string TempDir { get; set; } = Path.GetTempPath(); |
| 45 | + public string TempDir { get; set; } |
44 | 46 |
|
45 | 47 | [Option('e', "log-errors", HelpText = "Log errors to console")]
|
46 |
| - public bool IsLogErrors { get; set; } = false; |
| 48 | + public bool? IsLogErrors { get; set; } |
47 | 49 |
|
48 | 50 | [Option("log-debugs", HelpText = "Log debug messages")]
|
49 |
| - public bool IsLogDebugs { get; set; } = false; |
| 51 | + public bool? IsLogDebugs { get; set; } |
50 | 52 |
|
51 | 53 | [Option("no-indents", HelpText = "Do not indent dump trees")]
|
52 |
| - public bool NoIndentedDump { get; set; } = false; |
| 54 | + public bool? NoIndentedDump { get; set; } |
53 | 55 |
|
54 | 56 | [Option("no-text-spans", HelpText = "Do not include text spans in dump trees")]
|
55 |
| - public bool NotIncludeTextSpansInDump { get; set; } = false; |
| 57 | + public bool? NotIncludeTextSpansInDump { get; set; } |
56 | 58 |
|
57 |
| - [Option("line-column", HelpText = "Use line-column format for text spans in dump")] |
58 |
| - public bool LineColumnTextSpans { get; set; } = false; |
| 59 | + [Option("linear", HelpText = "Use linear format for text spans in dump")] |
| 60 | + public bool? LinearTextSpans { get; set; } |
59 | 61 |
|
60 | 62 | [Option("dump-code", HelpText = "Dump content of source code file to dump")]
|
61 |
| - public bool IncludeCodeInDump { get; set; } = false; |
| 63 | + public bool? IncludeCodeInDump { get; set; } |
| 64 | + |
| 65 | + [Option("not-strict", HelpText = "Not strict json deserialization if set true")] |
| 66 | + public bool? NotStrictJson { get; set; } |
62 | 67 |
|
63 | 68 | [Option("start-stage", HelpText = "Start stage to process (File or Ust)")]
|
64 |
| - public string StartStage { get; set; } = ""; |
| 69 | + public string StartStage { get; set; } |
65 | 70 |
|
66 |
| - [Option('d', "dump", HelpText = "Stages to be dumped (ParseTree, Ust)")] |
67 |
| - public string DumpStages { get; set; } = ""; |
| 71 | + [Option('d', "dump", HelpText = "Stages to be dumped (ParseTree, Ust)", Separator = ',')] |
| 72 | + public IEnumerable<string> DumpStages { get; set; } |
68 | 73 |
|
69 |
| - [Option('r', "render", HelpText = "Stages to be rendered")] |
70 |
| - public string RenderStages { get; set; } = ""; |
| 74 | + [Option('r', "render", HelpText = "Stages to be rendered", Separator = ',')] |
| 75 | + public IEnumerable<string> RenderStages { get; set; } |
71 | 76 |
|
72 | 77 | [Option("render-format", HelpText = "Graph render format (Png, Svg, etc.)")]
|
73 |
| - public string RenderFormat { get; set; } = GraphvizOutputFormat.Png.ToString(); |
| 78 | + public string RenderFormat { get; set; } |
74 | 79 |
|
75 | 80 | [Option("render-direction", HelpText = "Graph render direction (TopBottom, LeftRight, etc.)")]
|
76 |
| - public string RenderDirection { get; set; } = GraphvizDirection.TopBottom.ToString(); |
| 81 | + public string RenderDirection { get; set; } |
77 | 82 | }
|
78 | 83 | }
|
0 commit comments