Exemplo n.º 1
0
        private void PrintParseErrors(CommandLineSyntax commandLineSyntax)
        {
            var errors = commandLineSyntax.Errors;

            _console.WriteLine(commandLineSyntax.FullSpan);
            PrintParseErrorsMarkers(errors);

            int indexSpace = errors.Count.ToString().Length;

            for (int i = 0; i < errors.Count; i++)
            {
                var    error      = errors[i];
                string errorIndex = (i + 1).ToString().PadLeft(indexSpace);
                _console.WriteLine($"{errorIndex}) {error.Message}");
            }

            _console.WriteLine();
        }
Exemplo n.º 2
0
        public override string ToString()
        {
            var redirectUnions = "";
            var attributes     = new string[]
            {
                CommandLineSyntax.PipelineConditionToStr(PipelineCondition),
                HereScript != null?CommandLineSyntax.HereScript:null,
                InputRedirectSource != null?"<":null,
                OutputRedirectTarget != null?">":null,
                redirectUnions
            };
            var attrs = string.Join(' ', attributes.Where(x => x != null)).Trim();

            if (!string.IsNullOrWhiteSpace(attrs))
            {
                attrs = $" ({attrs})";
            }
            return($"{Darkgreen}{StartIndex}-{EndIndex}: {string.Join(' ', Segments.Select(x => x.Text))}"
                   + attrs
                   + ((NextUnit == null) ? "" : " " + (NextUnit == null?"":Br) + NextUnit.ToString()));
        }
Exemplo n.º 3
0
            /// <summary>
            /// Specifies the <see cref="CommandLineSyntax"/> to use for escaping arguments. Defaults to an instance of
            /// <see cref="WindowsCommandLineSyntax"/>
            /// </summary>
            public Options Syntax(CommandLineSyntax syntax)
            {
                Throw.IfNull(syntax, "syntax");

                this.CommandLineSyntax = syntax;
                return this;
            }
 public bool VisitCommandLine(CommandLineSyntax commandLine, CommandLineHighlightingVisitorParams <TStyle> param)
 {
     return(true);
 }
Exemplo n.º 5
0
 public ContextBuilder SetParsedCommandLine(CommandLineSyntax parsedCommandLine)
 {
     _parsedCommandLine = parsedCommandLine;
     return(this);
 }