mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-28 01:21:43 +00:00
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:
commit
db59c190c1
4 changed files with 160 additions and 3 deletions
|
|
@ -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}`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue