Remove worktree column from sessions list output

This commit is contained in:
Chris Wanstrath 2026-02-19 11:22:48 -08:00
parent e5085d50ed
commit 84ff27fd8e

View File

@ -170,15 +170,10 @@ program
return
}
const home = homedir()
const tilde = (p: string) => p.startsWith(home) ? "~" + p.slice(home.length) : p
const branchWidth = Math.max(6, ...sessions.map((s) => s.branch.length))
const worktreeWidth = Math.max(8, ...sessions.map((s) => tilde(s.worktree).length + 1))
console.log(`${"BRANCH".padEnd(branchWidth)} ${"WORKTREE".padEnd(worktreeWidth)} PROMPT`)
console.log(`${"BRANCH".padEnd(branchWidth)} PROMPT`)
for (const s of sessions) {
const wt = tilde(s.worktree) + "/"
console.log(`${s.branch.padEnd(branchWidth)} ${wt.padEnd(worktreeWidth)} ${s.prompt ?? ""}`)
console.log(`${s.branch.padEnd(branchWidth)} ${s.prompt ?? ""}`)
}
})