Merge pull request #12305 from NousResearch/bb/tui-status-git-branch

feat(tui): append git branch to cwd label in status bar
This commit is contained in:
brooklyn! 2026-04-18 17:27:40 -05:00 committed by GitHub
commit db59c190c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 160 additions and 3 deletions

View file

@ -4,3 +4,14 @@ export const shortCwd = (cwd: string, max = 28) => {
return p.length <= max ? p : `${p.slice(-(max - 1))}`
}
export const fmtCwdBranch = (cwd: string, branch: null | string, max = 40) => {
if (!branch) {
return shortCwd(cwd, max)
}
const b = branch.length > 16 ? `${branch.slice(-15)}` : branch
const tag = ` (${b})`
return `${shortCwd(cwd, Math.max(8, max - tag.length))}${tag}`
}