private static CommandLineBuilder BuildCommandLine() { var root = new RootCommand("Display project properties.") { Name = "projprops" }; ProjPropsOptions.DefineOptions(root); root.Handler = CommandHandler.Create <IHost>(host => host.Services.GetRequiredService <Worker>().Execute()); return(new CommandLineBuilder(root)); }
public Worker( IHostApplicationLifetime hostApplicationLifetime, ILogger <Worker> logger, IOptions <ProjPropsOptions> options, LoggingConfiguration runtimeLoggingConfiguration) { _hostApplicationLifetime = hostApplicationLifetime; _logger = logger; _options = options.Value; _nameRegex = _options.Name == null ? null : new Regex($"^{_options.Name}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (_options.Debug) { runtimeLoggingConfiguration.SetLevel(LogLevel.Debug); } }