forked from neil3d/excel2json
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.Options.cs
67 lines (58 loc) · 2.01 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
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;
}
[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('s', "sql", Required = false, HelpText = "export SQL file path.")]
public string SQLPath {
get;
set;
}
[Option('p', "csharp", Required = false, HelpText = "export C# data struct code file path.")]
public string CSharpPath {
get;
set;
}
[Option('h', "header", Required = true, 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;
}
}
}
}