readsBranches

tcmts.cli.help.readsBranches · #54d7i3kp · term · runs anywhere

Whether a command only reads, and so reads another branch with --branch (readBranch): tcm branch <name>'s argument, and tcm mcp --branch, are other things. (Every run asks, so it reads the route alone, not the help.)

import { paramsOf, routeOf } from "#codebase/tcmts/cli/help";

export function readsBranches(path: string[]): boolean {
  return paramsOf(routeOf(path)).some(
    (p) => p.name === "branch" && p.cli.syntax!.type === "option" && path[0] !== "mcp",
  );
}

uses

used by