Merge branch 'no-worktree'
# Conflicts: # src/cli.ts
This commit is contained in:
commit
1719a71cd9
11
src/cli.ts
11
src/cli.ts
|
|
@ -170,21 +170,16 @@ 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))
|
||||
const cols = process.stdout.columns || 80
|
||||
const prefixWidth = branchWidth + 2 + worktreeWidth + 2
|
||||
const prefixWidth = branchWidth + 2
|
||||
|
||||
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) + "/"
|
||||
const prompt = s.prompt ?? ""
|
||||
const maxPrompt = cols - prefixWidth
|
||||
const truncated = maxPrompt > 3 && prompt.length > maxPrompt ? prompt.slice(0, maxPrompt - 3) + "..." : prompt
|
||||
console.log(`${s.branch.padEnd(branchWidth)} ${wt.padEnd(worktreeWidth)} ${truncated}`)
|
||||
console.log(`${s.branch.padEnd(branchWidth)} ${truncated}`)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user