Skip to content

Commit

Permalink
to変換でもsubdivideを付けられるように(名前に反して@key等の実効的な設定が可能になっているため)
Browse files Browse the repository at this point in the history
  • Loading branch information
Narazaka committed Dec 4, 2018
1 parent a214806 commit 33bf227
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions seedtable/BasicOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ public class BasicOptions : CommonBasicOptions, IBasicOptions {

public IEnumerable<string> primary { get; set; } = new List<string> { };

public IEnumerable<string> subdivide { get; set; } = new List<string> { };

public bool calcFormulas { get; set; } = false;

public FromOptions FromOptions(IEnumerable<string> files = null, string input = ".", string output = ".") {
Expand Down Expand Up @@ -53,6 +51,7 @@ public ToOptions ToOptions(IEnumerable<string> files = null, string seedInput =
delete = delete,
seedExtension = seedExtension,
calcFormulas = calcFormulas,
subdivide = subdivide,
seedInput = seedInput,
xlsxInput = xlsxInput,
output = output,
Expand Down
6 changes: 3 additions & 3 deletions seedtable/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public enum Engine {
EPPlus,
}

[Option('S', "subdivide", Separator = ',', HelpText = "subdivide rules : [(pre cut):]sheet-name[:(post cut)]")]
public IEnumerable<string> subdivide { get; set; } = new List<string> { };

[Option('I', "ignore", Separator = ',', HelpText = "ignore sheet names")]
public IEnumerable<string> ignore { get; set; } = new List<string> { };

Expand Down Expand Up @@ -143,9 +146,6 @@ public class FromOptions : CommonOptions, IFromOptions {

[Option('P', "primary", Separator = ',', HelpText = "primary file for sheet names that exists in multiple files")]
public IEnumerable<string> primary { get; set; } = new List<string> { };

[Option('S', "subdivide", Separator = ',', HelpText = "subdivide rules : [(pre cut):]sheet-name[:(post cut)]")]
public IEnumerable<string> subdivide { get; set; } = new List<string> { };
}

[Verb("to", HelpText = "Yaml to(->) Excel")]
Expand Down
2 changes: 1 addition & 1 deletion seedtable/SeedTableInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static bool SeedToExcel(ToOptions options) {
static DateTime SeedToExcelCore(IExcelData excelData, string file, ToOptions options, DateTime startTime, DateTime previousTime) {
Log(" sheets");
var fileName = Path.GetFileName(file);
var sheetsConfig = new SheetsConfig(options.only, options.ignore, null, null, options.mapping, options.alias);
var sheetsConfig = new SheetsConfig(options.only, options.ignore, options.subdivide, null, options.mapping, options.alias);
var yamlDataCache = new Dictionary<string, YamlData>(); // aliasのため同テーブルはキャッシュする
foreach (var sheetName in excelData.SheetNames) {
var yamlTableName = sheetsConfig.YamlTableName(fileName, sheetName);
Expand Down

0 comments on commit 33bf227

Please sign in to comment.