entryName

tcmts.cli.main.entryName · #ulrw4z27 · term · runs anywhere

A history entry's name, by what it changed: update lib.f, or update lib.f, lib.g (+3) when more did (rather than the scratch file it came from). fallback if nothing's named.

export function entryName(command: string, paths: string[], fallback = command): string {
  const named = [...new Set(paths)];
  if (!named.length) return fallback;
  return `${command} ${named.slice(0, 2).join(", ")}${named.length > 2 ? ` (+${named.length - 2})` : ""}`;
}

used by