Ejemplo n.º 1
0
        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);
        }