-
Notifications
You must be signed in to change notification settings - Fork 492
/
Program.Options.cs
97 lines (84 loc) · 3.04 KB
/
Program.Options.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using System;
using CommandLine;
using CommandLine.Text;
namespace excel2json
{
partial class Program
{
/// <summary>
/// 命令行参数定义
/// </summary>
internal sealed class Options
{
public Options()
{
this.HeaderRows = 3;
this.Encoding = "utf8-nobom";
this.Lowcase = false;
this.ExportArray = false;
this.ForceSheetName = false;
}
[Option('e', "excel", Required = true, HelpText = "input excel file path.")]
public string ExcelPath {
get;
set;
}
[Option('j', "json", Required = false, HelpText = "export json file path.")]
public string JsonPath {
get;
set;
}
[Option('p', "csharp", Required = false, HelpText = "export C# data struct code file path.")]
public string CSharpPath {
get;
set;
}
[Option('h', "header", Required = false, DefaultValue = 1, HelpText = "number lines in sheet as header.")]
public int HeaderRows {
get;
set;
}
[Option('c', "encoding", Required = false, DefaultValue = "utf8-nobom", HelpText = "export file encoding.")]
public string Encoding {
get;
set;
}
[Option('l', "lowcase", Required = false, DefaultValue = false, HelpText = "convert filed name to lowcase.")]
public bool Lowcase {
get;
set;
}
[Option('a', "array", Required = false, DefaultValue = false, HelpText = "export as array, otherwise as dict object.")]
public bool ExportArray {
get;
set;
}
[Option('d', "date", Required = false, DefaultValue = "yyyy/MM/dd", HelpText = "Date Format String, example: dd / MM / yyy hh: mm:ss.")]
public string DateFormat {
get;
set;
}
[Option('s', "sheet", Required = false, DefaultValue = false, HelpText = "export with sheet name, even there's only one sheet.")]
public bool ForceSheetName {
get;
set;
}
[Option('x', "exclude_prefix", Required = false, DefaultValue = "", HelpText = "exclude sheet or column start with specified prefix.")]
public string ExcludePrefix {
get;
set;
}
[Option('l', "cell_json", Required = false, DefaultValue = false, HelpText = "convert json string in cell")]
public bool CellJson {
get;
set;
}
[Option('l', "all_string", Required = false, DefaultValue = false, HelpText = "all string")]
public bool AllString
{
get;
set;
}
}
}
}