PowerArgs.Cli.RegexHighlighter.ShouldBeHighlighted C# (CSharp) Method

ShouldBeHighlighted() public method

Returns true if the regular expression is matched, false otherwise
public ShouldBeHighlighted ( RichCommandLineContext readerContext, HighlighterContext highlighterContext ) : bool
readerContext RichCommandLineContext context from the reader
highlighterContext HighlighterContext context about the current token
return bool
        public override bool ShouldBeHighlighted(RichCommandLineContext readerContext, HighlighterContext highlighterContext)
        {
            var matches = regex.Matches(highlighterContext.CurrentToken.Value);
            foreach(Match match in matches)
            {
                if (match.Value == highlighterContext.CurrentToken.Value) return true;
            }
            return false;
        }