noLines

tcmts.cli.pattern.noLines · #nqddi56l · term · runs anywhere

What a search that found nothing says: the text it looked for (under a namespace), and, when that's text with characters a regular expression would have (a|b), that it was taken as written: a regular expression is written /…/.

import { writtenRegex } from "#codebase/tcmts/cli/pattern";

export function noLines(text: string, opts: { regex?: boolean; under?: string } = {}): string {
  const under = opts.under ? ` under ${opts.under}` : "";
  return opts.regex || writtenRegex(text)
    ? `no lines matching ${text}${under}`
    : `no lines with the text ${JSON.stringify(text)}${under}${/[|*\\^$[]/.test(text) ? " (text, as written: a regular expression is written /…/)" : ""}`;
}

uses

used by