Switched Generation command to use lambda handler.
This commit is contained in:
parent
be2cf466b4
commit
1cb6730bb1
@ -14,17 +14,13 @@ namespace DotNetResxUtils.Commands
|
||||
|
||||
public GenerationCommand() : base(NAME, DESC)
|
||||
{
|
||||
Argument<FileInfo> destArg = new Argument<FileInfo>("destination", "The destination path to store this file. If no extension is given, .resx will automatically be concatenated.");
|
||||
Add(destArg);
|
||||
|
||||
Option<FileInfo?> fromOpt = new Option<FileInfo?>("--from", "Generates a .resx file from the given file.");
|
||||
Add(fromOpt);
|
||||
|
||||
Argument<FileInfo> destArg = new Argument<FileInfo>("destination", "The destination path to store this file. If no extension is given, .resx will automatically be concatenated.");
|
||||
|
||||
this.AddOption(fromOpt);
|
||||
this.AddArgument(destArg);
|
||||
|
||||
this.SetHandler<FileInfo, FileInfo?>(CommandHandler, destArg, fromOpt);
|
||||
}
|
||||
private async void CommandHandler(FileInfo to, FileInfo? from)
|
||||
this.SetHandler(async (FileInfo to, FileInfo? from) =>
|
||||
{
|
||||
IDictionary<string, string> flattened = new Dictionary<string, string>();
|
||||
if (from != null)
|
||||
@ -38,6 +34,7 @@ namespace DotNetResxUtils.Commands
|
||||
resxWriter.AddResource(keyVal.Key, keyVal.Value);
|
||||
}
|
||||
}
|
||||
}, destArg, fromOpt);
|
||||
}
|
||||
|
||||
private async Task<IDictionary<string, string>> FlattenJson(FileInfo jsonFile)
|
||||
|
Loading…
Reference in New Issue
Block a user