public CommandLineProcessor(IEnumerable <string> arguments) { _arguments = new Queue <string>(arguments ?? throw new ArgumentNullException(nameof(arguments))); var instanceProcessor = new InstanceProcessor <StandardOptions>(_standardOptions); instanceProcessor.Parse(_arguments, _errors); _processors.Add(instanceProcessor); _optionHelp = new Lazy <List <string> >(CreateHelp, LazyThreadSafetyMode.ExecutionAndPublication); }
private InstanceProcessor <T> FindLeafProcessor <T>(T driver) where T : class { var processor = new InstanceProcessor <T>(driver); while (_arguments.Any()) { var modeName = _arguments.Peek(); var mode = processor.Modes.SingleOrDefault(m => m.HasName(modeName)); if (mode == null) { break; } var newDriver = (T)mode.Activate(); processor = new InstanceProcessor <T>(newDriver); _arguments.Dequeue(); } return(processor); }