File tree Expand file tree Collapse file tree
packages/opencode/src/cli/cmd/tui Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { cmd } from "../cmd"
2+ import { UI } from "@/cli/ui"
23import { tui } from "./app"
34import { win32DisableProcessedInput , win32InstallCtrlCGuard } from "./win32"
45
@@ -16,11 +17,20 @@ export const AttachCommand = cmd({
1617 type : "string" ,
1718 description : "directory to run in" ,
1819 } )
20+ . option ( "continue" , {
21+ alias : [ "c" ] ,
22+ describe : "continue the last session" ,
23+ type : "boolean" ,
24+ } )
1925 . option ( "session" , {
2026 alias : [ "s" ] ,
2127 type : "string" ,
2228 describe : "session id to continue" ,
2329 } )
30+ . option ( "fork" , {
31+ type : "boolean" ,
32+ describe : "fork the session when continuing (use with --continue or --session)" ,
33+ } )
2434 . option ( "password" , {
2535 alias : [ "p" ] ,
2636 type : "string" ,
@@ -31,6 +41,12 @@ export const AttachCommand = cmd({
3141 try {
3242 win32DisableProcessedInput ( )
3343
44+ if ( args . fork && ! args . continue && ! args . session ) {
45+ UI . error ( "--fork requires --continue or --session" )
46+ process . exitCode = 1
47+ return
48+ }
49+
3450 const directory = ( ( ) => {
3551 if ( ! args . dir ) return undefined
3652 try {
@@ -49,7 +65,11 @@ export const AttachCommand = cmd({
4965 } ) ( )
5066 await tui ( {
5167 url : args . url ,
52- args : { sessionID : args . session } ,
68+ args : {
69+ continue : args . continue ,
70+ sessionID : args . session ,
71+ fork : args . fork ,
72+ } ,
5373 directory,
5474 headers,
5575 } )
You can’t perform that action at this time.
0 commit comments