Example #1
0
        public CommandLineCommand(CommandLineParserOptions parserOptions, IServiceProvider serviceProvider, TOption option, IValidatorsContainer validators, ILogger logger, IModelInitializer modelInitializer, IArgumentManager argumentManager)
        {
            m_parserOptions = parserOptions ?? throw new ArgumentNullException(nameof(parserOptions));
            m_commandOption = new TCommandOption();

            m_validators          = validators ?? throw new ArgumentNullException(nameof(validators));
            this.logger           = logger ?? throw new ArgumentNullException(nameof(logger));
            this.modelInitializer = modelInitializer ?? throw new ArgumentNullException(nameof(modelInitializer));
            this.argumentManager  = argumentManager ?? throw new ArgumentNullException(nameof(argumentManager));
            m_serviceProvider     = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
            m_baseOption          = option ?? throw new ArgumentNullException(nameof(option));

            (m_helpOptionName, m_helpOptionNameLong) = parserOptions.GetConfiguredHelpOption();

            InitialzeModel();
        }
Example #2
0
            public ArgumentRecordEnumerator(CommandLineParserOptions options, IReadOnlyList <string> arguments)
            {
                if (arguments is null)
                {
                    throw new ArgumentNullException(nameof(arguments));
                }

                if (options is null)
                {
                    throw new ArgumentNullException(nameof(options));
                }

                enumerator     = arguments.GetEnumerator();
                prefixShort    = options.PrefixShortOption;
                prefixLong     = options.PrefixLongOption;
                postFix        = options.PostfixOption;
                stopParsing    = options.StopParsingAfter;
                help           = options.GetConfiguredHelpOption();
                canStopParsing = !string.IsNullOrEmpty(options.StopParsingAfter);
            }