PowerArgs.Cli.SimpleSyntaxHighlighter.AddConditionalKeyword C# (CSharp) Method

AddConditionalKeyword() public method

Registers a keyword with the highlighter that should only be highlighted if some condition is true
public AddConditionalKeyword ( string keyword, Func conditionEval, ConsoleColor fg = null, ConsoleColor bg = null, System.StringComparison comparison = StringComparison.InvariantCulture ) : void
keyword string The keyword that will conditionally be highlighted when found on the command line
conditionEval Func the conditional evaluation function
fg ConsoleColor The foreground highlight color
bg ConsoleColor The background highlight color
comparison System.StringComparison Determines how strings are compared.
return void
        public void AddConditionalKeyword(string keyword, Func<RichCommandLineContext,HighlighterContext, bool> conditionEval, ConsoleColor? fg = null, ConsoleColor? bg = null, StringComparison comparison = StringComparison.InvariantCulture)
        {
            TokenHighlighters.Add(new ConditionalKeywordHighlighter(keyword, conditionEval,  fg, bg, comparison));
        }