MCPcopy Index your code
hub / github.com/coder/mux / buildOutput

Function buildOutput

tests/ui/git/parseStatusOutput.test.ts:9–43  ·  view source on GitHub ↗
(opts: {
  headBranch?: string;
  primaryBranch?: string;
  ahead?: number;
  behind?: number;
  dirty?: number;
  outAdd?: number;
  outDel?: number;
  inAdd?: number;
  inDel?: number;
})

Source from the content-addressed store, hash-verified

7
8// Helper to build script output matching the bash echo format
9function buildOutput(opts: {
10 headBranch?: string;
11 primaryBranch?: string;
12 ahead?: number;
13 behind?: number;
14 dirty?: number;
15 outAdd?: number;
16 outDel?: number;
17 inAdd?: number;
18 inDel?: number;
19}): string {
20 const {
21 headBranch = "feature-x",
22 primaryBranch = "main",
23 ahead = 0,
24 behind = 0,
25 dirty = 0,
26 outAdd = 0,
27 outDel = 0,
28 inAdd = 0,
29 inDel = 0,
30 } = opts;
31 return [
32 "---HEAD_BRANCH---",
33 headBranch,
34 "---PRIMARY---",
35 primaryBranch,
36 "---AHEAD_BEHIND---",
37 `${ahead}\t${behind}`,
38 "---DIRTY---",
39 `${dirty}`,
40 "---LINE_DELTA---",
41 `${outAdd} ${outDel} ${inAdd} ${inDel}`,
42 ].join("\n");
43}
44
45describe("parseGitStatusScriptOutput", () => {
46 it("parses headBranch from output", () => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected