Simplify default command fallback to always run list when no args given
This commit is contained in:
parent
2eba71ce87
commit
5b9998b138
13
src/cli.ts
13
src/cli.ts
|
|
@ -169,17 +169,10 @@ program
|
|||
.description("Output fish shell completions")
|
||||
.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 (args.length === 0) {
|
||||
try {
|
||||
const root = await git.repoRoot()
|
||||
const st = await state.load(root)
|
||||
if (Object.keys(st.sessions).length > 0) {
|
||||
process.argv.push("list")
|
||||
}
|
||||
} catch {}
|
||||
if (process.argv.length === 2) {
|
||||
process.argv.push("list")
|
||||
}
|
||||
|
||||
program.parseAsync().catch((err) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user