public void WritePath( FileMatch fileMatch, List <ReplaceItem> items, ConsoleColors replacementColors, string?basePath, string?indent = null) { Write(indent ?? Indent, Verbosity); string path = fileMatch.Path; int startIndex = GetBasePathLength(path, basePath); if (!RelativePath) { Write(path, 0, startIndex, Colors.BasePath, Verbosity); } foreach (ReplaceItem item in items) { Match match = item.Match; Write(path, startIndex, fileMatch.NameSpan.Start + match.Index - startIndex, Verbosity); if (!MatchColors.IsDefault) { Write(match.Value, MatchColors, Verbosity); } Write(item.Value, replacementColors, Verbosity); startIndex = fileMatch.NameSpan.Start + match.Index + match.Length; } Write(path, startIndex, path.Length - startIndex, Verbosity); }
public PathWriter( ConsoleColors pathColors, ConsoleColors matchColors = default, bool relativePath = false, string?indent = null, Verbosity verbosity = Verbosity.Minimal) { PathColors = pathColors; MatchColors = matchColors; RelativePath = relativePath; Indent = indent; Verbosity = verbosity; }