public T?Build() { if (Args == null || Args.Length == 0) { return(null); } string[] switchNames = typeof(T).GetProperties() .Where(x => x.PropertyType == typeof(bool)) .Select(x => x.Name) .ToArray(); string[] args = (Args ?? Array.Empty <string>()) .Select(x => switchNames.Contains(x, StringComparer.OrdinalIgnoreCase) ? x + "=true" : x) .ToArray(); string?environment = null; string?secretId = null; T option; while (true) { IConfiguration config = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .Action(x => ConfigFiles?.ForEach(y => x.AddJsonFile(y))) .Func(x => GetEnvironmentConfig(environment) switch { Stream v => x.AddJsonStream(v), _ => x })
public T?Build() { string[] switchNames = typeof(T).GetProperties() .Where(x => x.PropertyType == typeof(bool)) .Select(x => x.Name) .ToArray(); string[] args = (Args ?? Array.Empty <string>()) .Select(x => switchNames.Contains(x, StringComparer.OrdinalIgnoreCase) ? x + "=true" : x) .ToArray(); if (EnableHelp) { var helpSignals = new[] { "?", "/?", "-?", "--?", "help", "-help", "--help" }; args = args.Select(x => helpSignals.Any(y => y == x) ? "help=true" : x).ToArray(); } string?environment = null; string?secretId = null; T option; while (true) { IConfiguration config = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .Action(x => ConfigFiles?.ForEach(y => x.AddJsonFile(y))) .Func(x => GetEnvironmentConfig(environment) switch { Stream v => x.AddJsonStream(v), _ => x })