@@ -1104,6 +1104,7 @@ func buildServiceForkCmd() *cobra.Command {
11041104 var forkToTimestamp string
11051105 var forkCPU int
11061106 var forkMemory int
1107+ var forkWithPassword bool
11071108
11081109 cmd := & cobra.Command {
11091110 Use : "fork [service-id]" ,
@@ -1320,20 +1321,26 @@ Examples:
13201321 }
13211322
13221323 // Handle wait behavior
1324+ var result error
13231325 if forkNoWait {
13241326 fmt .Fprintf (statusOutput , "⏳ Service is being forked. Use 'tiger service list' to check status.\n " )
1325- return nil
1327+ } else {
1328+ // Wait for service to be ready
1329+ fmt .Fprintf (statusOutput , "⏳ Waiting for fork to complete (timeout: %v)...\n " , forkWaitTimeout )
1330+ forkedService .Status , result = waitForServiceReady (client , projectID , forkedServiceID , forkWaitTimeout , statusOutput )
1331+ if result != nil {
1332+ fmt .Fprintf (statusOutput , "❌ %v\n " , result )
1333+ } else {
1334+ fmt .Fprintf (statusOutput , "🎉 Service fork completed successfully!\n " )
1335+ printConnectMessage (statusOutput , passwordSaved , forkNoSetDefault , forkedServiceID )
1336+ }
13261337 }
13271338
1328- // Wait for service to be ready with custom timeout
1329- fmt .Fprintf (statusOutput , "⏳ Waiting for fork to complete (timeout: %v)...\n " , forkWaitTimeout )
1330- if _ , err := waitForServiceReady (client , projectID , forkedServiceID , forkWaitTimeout , statusOutput ); err != nil {
1331- return err
1339+ if err := outputService (cmd , forkedService , cfg .Output , forkWithPassword ); err != nil {
1340+ fmt .Fprintf (statusOutput , "⚠️ Warning: Failed to output service details: %v\n " , err )
13321341 }
1333- fmt .Fprintf (statusOutput , "🎉 Service fork completed successfully!\n " )
1334- printConnectMessage (statusOutput , passwordSaved , forkNoSetDefault , serviceID )
1335- return nil
13361342
1343+ return result
13371344 case 401 :
13381345 return exitWithCode (ExitAuthenticationError , fmt .Errorf ("authentication failed: invalid API key" ))
13391346 case 403 :
@@ -1364,6 +1371,7 @@ Examples:
13641371 // Resource customization flags
13651372 cmd .Flags ().IntVar (& forkCPU , "cpu" , 0 , "CPU allocation in millicores (inherits from source if not specified)" )
13661373 cmd .Flags ().IntVar (& forkMemory , "memory" , 0 , "Memory allocation in gigabytes (inherits from source if not specified)" )
1374+ cmd .Flags ().BoolVar (& forkWithPassword , "with-password" , false , "Include initial password in output" )
13671375
13681376 return cmd
13691377}
0 commit comments