public static string[] Process(string[] args) { if (args == null) { return(null); } var nonConfigurationSwitches = new List <string>(); foreach (var a in args) { var match = Regex.Match(a, @"[\w\.]+"); if (match.Success && RavenConfiguration.ContainsKey(match.Value)) { continue; } nonConfigurationSwitches.Add(a); } _app = new CommandLineApplication(); _helpOption = _app.Option( "-h | -? | --help", "Shows help", CommandOptionType.NoValue); _versionOption = _app.Option( "-v | --version", "Displays version and exits", CommandOptionType.NoValue); _printIdOption = _app.Option( "--print-id", "Prints server ID upon server start", CommandOptionType.NoValue); _daemonOption = _app.Option( "-d | --daemon", "Runs as daemon (available only for Linux). Windows users should use --register-service and services.msc for service management", CommandOptionType.NoValue); _serviceNameOption = _app.Option( "--service-name", "Sets service name", CommandOptionType.SingleValue); _customConfigPathOption = _app.Option( "-c | --config-path", "Sets custom configuration file path", CommandOptionType.SingleValue); _browserOption = _app.Option( "--browser", "Attempts to open RavenDB Studio in the browser", CommandOptionType.NoValue); _app.Execute(nonConfigurationSwitches.ToArray()); Validate(); return(args.Except(nonConfigurationSwitches).ToArray()); }
public static string[] Process(string[] args) { if (args == null) { return(null); } var nonConfigurationSwitches = new List <string>(); foreach (var a in args) { var match = Regex.Match(a, @"[\w\.]+"); if (match.Success && RavenConfiguration.ContainsKey(match.Value)) { continue; } nonConfigurationSwitches.Add(a); } _app = new CommandLineApplication(); _helpOption = _app.Option( "-h | -? | --help", "Shows help", CommandOptionType.NoValue); _versionOption = _app.Option( "-v | --version", "Displays version and exits", CommandOptionType.NoValue); _printIdOption = _app.Option( "--print-id", "Prints server ID upon server start", CommandOptionType.NoValue); _nonInteractiveOption = _app.Option( "-n | --non-interactive", "Run in non-interactive mode", CommandOptionType.NoValue); _serviceNameOption = _app.Option( "--service-name", "Sets service name", CommandOptionType.SingleValue); _customConfigPathOption = _app.Option( "-c | --config-path", "Sets custom configuration file path", CommandOptionType.SingleValue); _browserOption = _app.Option( "--browser", "Attempts to open RavenDB Studio in the browser", CommandOptionType.NoValue); _logToConsole = _app.Option( "-l | --log-to-console", "Print logs to console (when run in non-interactive mode)", CommandOptionType.NoValue); _app.Execute(nonConfigurationSwitches.ToArray()); Validate(); return(args.Except(nonConfigurationSwitches).ToArray()); }