public void Configure(CommandLineApplication cli) { var baseOptions = _configureBaseOptions(cli); var xrayOptions = new XRayBuildOptions { DataUrl = cli.Option("--dataurl", "URL (or path to an XML/TXT file) from which the terms should be loaded. If not specified, terms will come from Roentgen if possible.", CommandOptionType.SingleValue), // AliasFile = cli.Option("--aliases", "Optional path to an alias file. If not specified, the default path will be used.", CommandOptionType.SingleValue), IncludeTopics = cli.Option("--topics", "When set, topics will be included with the set of imported terms. Default is false.", CommandOptionType.NoValue), SplitAliases = cli.Option("--splitaliases", "When set, aliases will be automatically split apart using a set of common titles, prefixes, etc.", CommandOptionType.NoValue) }; cli.OnExecuteAsync(cancellationToken => ConsoleHost.WaitForShutdownAsync(ct => OnExecute(baseOptions, xrayOptions, ct))); }
private static void RunAsDaemon(string[] args) { logger.Info("Running as daemon"); try { Start(null, new StringsEventArgs(args)); if (CheckConsole()) { logger.Info("Application running. Press Ctrl+C to shut down."); } ConsoleHost.WaitForShutdownAsync().GetAwaiter().GetResult(); } catch (Exception ex) { ShowUnhandledException(ex); } finally { Stop(null, EventArgs.Empty); } }