Simplify default command fallback to always run list when no args given

This commit is contained in:
Chris Wanstrath 2026-02-22 12:35:30 -08:00
parent 2eba71ce87
commit 5b9998b138

View File

@ -169,17 +169,10 @@ program
.description("Output fish shell completions") .description("Output fish shell completions")
.action((opts: { install?: boolean }) => completionsAction(program, opts)) .action((opts: { install?: boolean }) => completionsAction(program, opts))
// ── Default: show list if sessions exist, otherwise help ───────────── // ── Default: `sandlot` → `sandlot list` ─────────────────────────────
const args = process.argv.slice(2) if (process.argv.length === 2) {
if (args.length === 0) { process.argv.push("list")
try {
const root = await git.repoRoot()
const st = await state.load(root)
if (Object.keys(st.sessions).length > 0) {
process.argv.push("list")
}
} catch {}
} }
program.parseAsync().catch((err) => { program.parseAsync().catch((err) => {