Exemple #1
0
        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));
        }
Exemple #2
0
    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);
        }
    }