コード例 #1
0
ファイル: CommandNode.cs プロジェクト: mmoenfly/GitCook2021
        internal CommandProcessorBase AddToPipeline(
            PipelineProcessor pipeline,
            ExecutionContext context)
        {
            if (pipeline == null)
            {
                throw ParseTreeNode.tracer.NewArgumentNullException(nameof(pipeline));
            }
            int index;
            CommandProcessorBase commandProcessor = this.CreateCommandProcessor(out index, context);

            foreach (CommandParameterInternal parametersAndArgument in (IEnumerable <CommandParameterInternal>) this.BindParametersAndArguments(index, context))
            {
                commandProcessor.AddParameter(parametersAndArgument);
            }
            string       helpTarget;
            HelpCategory helpCategory;

            if (commandProcessor.IsHelpRequested(out helpTarget, out helpCategory))
            {
                commandProcessor = CommandProcessorBase.CreateGetHelpCommandProcessor(context, helpTarget, helpCategory);
                commandProcessor.Command.MyInvocation.ScriptToken = (Token)this._elements[0];
            }
            pipeline.Add(commandProcessor);
            this.BindRedirectionPipes(commandProcessor, pipeline, context);
            return(commandProcessor);
        }