Esempio n. 1
0
        /// <summary>
        /// Does not include OriginalInput or Tokens because they could contain passwords<br/>
        /// WARN: includeOriginalArgs could expose passwords.
        /// </summary>
        public string ToString(Indent indent, bool includeOriginalArgs)
        {
            // Do not include OriginalInput or Tokens because they
            // could contain passwords.
            // Use ParseResults instead if needed

            indent = indent.Increment();

            var insecure = includeOriginalArgs
                ? $"{indent}Original.Args:{Original.Args.ToCsv(" ")}{NewLine}" +
                           $"{indent}{nameof(Tokens)}:{Tokens.ToArgsArray().ToCsv(" ")}{NewLine}"
                : "";

            return($"{nameof(CommandContext)}:{NewLine}" +
                   $"{indent}{nameof(RootCommand)}:{RootCommand}{NewLine}" +
                   $"{indent}{nameof(ShowHelpOnExit)}:{ShowHelpOnExit}{NewLine}" +
                   $"{insecure}" +
                   $"{indent}{nameof(ParseResult)}:{ParseResult?.ToString(indent.Increment())}{NewLine}" +
                   $"{indent}{nameof(InvocationPipeline)}:{InvocationPipeline?.ToString(indent.Increment())}{NewLine}");
        }
        private InvocationPipeline CreatePipeline <TService>(
            TService instace,
            string methodName,
            MethodBoundaryAspect[] boundaryAspects,
            params object[] arguments)
        {
            var invocation = new ObservableInvocation(typeof(TService), instace, methodName, arguments);
            var pipeline   = new InvocationPipeline(
                new InvocationSignature(
                    invocation.Method,
                    invocation.TargetMethod,
                    invocation.DeclaringType,
                    invocation.TargetType,
                    invocation.InvocationType),
                boundaryAspects, BypassMethodAspect.Instance);

            pipeline.Init(invocation);

            return(pipeline);
        }