slotWork

tcmts.cli.running.slotWork · #j6eitf52 · term · runs anywhere

What a slot's holder (or one waiting) runs, read from what it says it is, <kind> of <codebase> on <branch>: its kind (tcm test: suites; test definitions; app build; verify; …), the codebase's directory and the branch (when it said them).

export function slotWork(what: string): { kind: string; root?: string; branch?: string } {
  const m = /^(.*?) of (\S.*?)(?: on (\S+))?$/.exec(what);
  if (!m) return { kind: what };
  return { kind: m[1]!, root: m[2]!, ...(m[3] ? { branch: m[3] } : {}) };
}

used by