public bool TryParse(MatchCommandOptions options) { var baseOptions = (RegexCommandOptions)options; if (!TryParse(baseOptions)) { return(false); } options = (MatchCommandOptions)baseOptions; if (!FilterParser.TryParse(Content, OptionNames.Content, OptionValueProviders.PatternOptionsWithoutPartAndNegativeProvider, out Filter? filter)) { return(false); } if (!TryParseAsEnumFlags(Highlight, OptionNames.Highlight, out HighlightOptions highlightOptions, defaultValue: HighlightOptions.Default, provider: OptionValueProviders.MatchHighlightOptionsProvider)) { return(false); } options.Filter = filter !; options.HighlightOptions = highlightOptions; options.MaxCount = MaxCount; return(true); }
internal static void WriteMatchCommand(MatchCommandOptions options) { WriteDisplayFormat("display", options.Format); WriteFilter("filter", options.Filter); WriteOption("highlight options", options.HighlightOptions); WriteInput(options.Input); WriteOption("max count", options.MaxCount); }
private static int Match(MatchCommandLineOptions commandLineOptions) { var options = new MatchCommandOptions(); if (!commandLineOptions.TryParse(options)) { return(2); } return(Execute(new MatchCommand(options))); }
public int WriteMatches( MatchData matchData, MatchCommandOptions options, in CancellationToken cancellationToken = default)