This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

--json for the list command

Nathan Herald (Mar 10, 2026, 12:05 AM +0100) 6009d6c0 c96d1f19

+21 -2
+21 -2
src/cli.ts
··· 34 34 pty send <name> --seq "text" --seq key:return Send an ordered sequence 35 35 pty restart <name> Restart an exited session 36 36 pty list List active sessions 37 + pty list --json List sessions as JSON 37 38 pty kill <name> Kill or remove a session 38 39 39 40 Detach from a session with Ctrl+\\ (press twice to send Ctrl+\\ to the process)`); ··· 185 186 186 187 case "list": 187 188 case "ls": { 188 - await cmdList(); 189 + const jsonFlag = args.includes("--json"); 190 + await cmdList(jsonFlag); 189 191 break; 190 192 } 191 193 ··· 355 357 }); 356 358 } 357 359 358 - async function cmdList(): Promise<void> { 360 + async function cmdList(json = false): Promise<void> { 359 361 const sessions = await listSessions(); 362 + 363 + if (json) { 364 + const output = sessions.map((s) => ({ 365 + name: s.name, 366 + status: s.status, 367 + pid: s.pid, 368 + command: s.metadata 369 + ? [s.metadata.displayCommand, ...s.metadata.args].join(" ") 370 + : null, 371 + cwd: s.metadata?.cwd ?? null, 372 + createdAt: s.metadata?.createdAt ?? null, 373 + exitCode: s.metadata?.exitCode ?? null, 374 + exitedAt: s.metadata?.exitedAt ?? null, 375 + })); 376 + console.log(JSON.stringify(output)); 377 + return; 378 + } 360 379 361 380 if (sessions.length === 0) { 362 381 console.log("No active sessions.");