From 864290cd2d9f4902734d747fef25865aa2dba407 Mon Sep 17 00:00:00 2001 From: Erik Ejlskov Jensen Date: Tue, 19 Dec 2023 10:20:11 +0100 Subject: [PATCH] add output type option --- src/GUI/efcpt.7/Options/OutputType.cs | 7 +++++++ src/GUI/efcpt.7/Options/ScaffoldOptions.cs | 6 ++++++ src/GUI/efcpt.7/Program.cs | 6 +++++- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/GUI/efcpt.7/Options/OutputType.cs diff --git a/src/GUI/efcpt.7/Options/OutputType.cs b/src/GUI/efcpt.7/Options/OutputType.cs new file mode 100644 index 000000000..aab6c50ed --- /dev/null +++ b/src/GUI/efcpt.7/Options/OutputType.cs @@ -0,0 +1,7 @@ +namespace ErikEJ.EFCorePowerTools; + +public enum OutputType +{ + Csharp, + Diagram, +} diff --git a/src/GUI/efcpt.7/Options/ScaffoldOptions.cs b/src/GUI/efcpt.7/Options/ScaffoldOptions.cs index 65cd19079..0d3dee6b6 100644 --- a/src/GUI/efcpt.7/Options/ScaffoldOptions.cs +++ b/src/GUI/efcpt.7/Options/ScaffoldOptions.cs @@ -29,6 +29,12 @@ internal sealed class ScaffoldOptions HelpText = $"Full pathname to the {Constants.ConfigFileName} file, default is '{Constants.ConfigFileName}' in currrent directory")] public FileInfo ConfigFile { get; set; } + [Option( + 't', + "type", + HelpText = "Type of output, defaults to C# code, can be 'csharp' or 'diagram'")] + public OutputType Type { get; set; } + public bool IsDacpac => ConnectionString?.EndsWith(".dacpac", StringComparison.OrdinalIgnoreCase) ?? false; } #pragma warning restore CA1812 // Avoid uninstantiated internal classes diff --git a/src/GUI/efcpt.7/Program.cs b/src/GUI/efcpt.7/Program.cs index 4ee0100ca..2110ee078 100644 --- a/src/GUI/efcpt.7/Program.cs +++ b/src/GUI/efcpt.7/Program.cs @@ -32,7 +32,11 @@ public static async Task Main(string[] args) public static async Task MainAsync(string[] args) { - using var parser = new Parser(c => c.HelpWriter = null); + using var parser = new Parser(c => + { + c.HelpWriter = null; + c.CaseInsensitiveEnumValues = true; + }); var parserResult = parser.ParseArguments(args);