Skip to content

Commit

Permalink
Refactor config, add namespace.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Sampson committed Dec 11, 2020
1 parent 2af7f03 commit 531e944
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Compiler/CommandLineFlags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -491,18 +491,22 @@ private static bool TryParseConfig(CommandLineFlags flagStore, string? configPat
{
flagStore.SchemaDirectory = inputDirectoryElement.GetString();
}
if (root.TryGetProperty("namespace", out var nameSpaceElement))
{
flagStore.Namespace = nameSpaceElement.GetString();
}
if (root.TryGetProperty("generators", out var generatorsElement))
{
foreach (var generatorElement in generatorsElement.EnumerateArray())
{
if (generatorElement.TryGetProperty("alias", out var aliasElement) &&
generatorElement.TryGetProperty("destinationPath", out var destinationElement))
generatorElement.TryGetProperty("outputFile", out var outputElement))
{
foreach (var flagAttribute in GetFlagAttributes()
.Where(flagAttribute => flagAttribute.Attribute.IsGeneratorFlag &&
flagAttribute.Attribute.Name.Equals(aliasElement.GetString())))
{
flagAttribute.Property.SetValue(flagStore, destinationElement.GetString());
flagAttribute.Property.SetValue(flagStore, outputElement.GetString());
}
}
}
Expand Down

0 comments on commit 531e944

Please sign in to comment.