Merge branch 'sandlot-list'
This commit is contained in:
commit
de0a3487e4
16
src/cli.ts
16
src/cli.ts
|
|
@ -125,10 +125,12 @@ program
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const effectivePrompt = opts.print || prompt
|
||||||
await state.setSession(root, {
|
await state.setSession(root, {
|
||||||
branch,
|
branch,
|
||||||
worktree: worktreeAbs,
|
worktree: worktreeAbs,
|
||||||
created_at: new Date().toISOString(),
|
created_at: new Date().toISOString(),
|
||||||
|
...(effectivePrompt ? { prompt: effectivePrompt } : {}),
|
||||||
})
|
})
|
||||||
|
|
||||||
if (opts.print) {
|
if (opts.print) {
|
||||||
|
|
@ -168,10 +170,15 @@ program
|
||||||
return
|
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 branchWidth = Math.max(6, ...sessions.map((s) => s.branch.length))
|
||||||
console.log(`${"BRANCH".padEnd(branchWidth)} WORKTREE`)
|
const worktreeWidth = Math.max(8, ...sessions.map((s) => tilde(s.worktree).length + 1))
|
||||||
|
console.log(`${"BRANCH".padEnd(branchWidth)} ${"WORKTREE".padEnd(worktreeWidth)} PROMPT`)
|
||||||
for (const s of sessions) {
|
for (const s of sessions) {
|
||||||
console.log(`${s.branch.padEnd(branchWidth)} ${s.worktree}/`)
|
const wt = tilde(s.worktree) + "/"
|
||||||
|
console.log(`${s.branch.padEnd(branchWidth)} ${wt.padEnd(worktreeWidth)} ${s.prompt ?? ""}`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -193,6 +200,11 @@ program
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const effectivePrompt = opts.print || prompt
|
||||||
|
if (effectivePrompt) {
|
||||||
|
await state.setSession(root, { ...session, prompt: effectivePrompt })
|
||||||
|
}
|
||||||
|
|
||||||
const spin = spinner("Starting container")
|
const spin = spinner("Starting container")
|
||||||
await vm.ensure((msg) => { spin.text = msg })
|
await vm.ensure((msg) => { spin.text = msg })
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ export interface Session {
|
||||||
branch: string
|
branch: string
|
||||||
worktree: string
|
worktree: string
|
||||||
created_at: string
|
created_at: string
|
||||||
|
prompt?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface State {
|
export interface State {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user