@@ -427,7 +427,7 @@ Note: You can specify both CPU and memory together, or specify only one (the oth
427427
428428 // Save password immediately after service creation, before any waiting
429429 // This ensures users have access even if they interrupt the wait or it fails
430- handlePasswordSaving (service , initialPassword , statusOutput )
430+ passwordSaved := handlePasswordSaving (service , initialPassword , statusOutput )
431431
432432 // Set as default service unless --no-set-default is specified
433433 if ! createNoSetDefault {
@@ -447,6 +447,8 @@ Note: You can specify both CPU and memory together, or specify only one (the oth
447447 service .Status , result = waitForServiceReady (client , projectID , serviceID , createWaitTimeout , statusOutput )
448448 if result != nil {
449449 fmt .Fprintf (statusOutput , "❌ %v\n " , result )
450+ } else {
451+ printConnectMessage (statusOutput , passwordSaved , createNoSetDefault , serviceID )
450452 }
451453 }
452454
@@ -455,7 +457,6 @@ Note: You can specify both CPU and memory together, or specify only one (the oth
455457 }
456458
457459 return result
458-
459460 case 400 :
460461 return fmt .Errorf ("invalid request parameters" )
461462 case 401 :
@@ -875,27 +876,29 @@ func waitForServiceReady(client *api.ClientWithResponses, projectID, serviceID s
875876 }
876877}
877878
878- // handlePasswordSaving handles saving password using the configured storage method and displaying appropriate messages
879- func handlePasswordSaving (service api.Service , initialPassword string , output io.Writer ) {
879+ // handlePasswordSaving handles saving password using the configured storage
880+ // method and displaying appropriate messages. Returns true if the password was
881+ // successfully saved, or false if not.
882+ func handlePasswordSaving (service api.Service , initialPassword string , output io.Writer ) bool {
880883 // Note: We don't fail the service creation if password saving fails
881884 // The error is handled by displaying the appropriate message below
882885 result , _ := password .SavePasswordWithResult (service , initialPassword )
883886
884887 if result .Method == "none" && result .Message == "No password provided" {
885888 // Don't output anything for empty password
886- return
889+ return false
887890 }
888891
889892 // Output the message with appropriate emoji
890893 if result .Success {
891894 fmt .Fprintf (output , "🔐 %s\n " , result .Message )
895+ return true
896+ } else if result .Method == "none" {
897+ fmt .Fprintf (output , "💡 %s\n " , result .Message )
892898 } else {
893- if result .Method == "none" {
894- fmt .Fprintf (output , "💡 %s\n " , result .Message )
895- } else {
896- fmt .Fprintf (output , "⚠️ %s\n " , result .Message )
897- }
899+ fmt .Fprintf (output , "⚠️ %s\n " , result .Message )
898900 }
901+ return false
899902}
900903
901904// setDefaultService sets the given service as the default service in the configuration
@@ -914,6 +917,19 @@ func setDefaultService(serviceID string, output io.Writer) error {
914917 return nil
915918}
916919
920+ func printConnectMessage (output io.Writer , passwordSaved , noSetDefault bool , serviceID string ) {
921+ if ! passwordSaved {
922+ // We can't connect if no password was saved, so don't show message
923+ return
924+ } else if noSetDefault {
925+ // If the service wasn't set as the default, include the serviceID in the command
926+ fmt .Fprintf (output , "🔌 Run 'tiger db connect %s' to connect to your new service\n " , serviceID )
927+ } else {
928+ // If the service was set as the default, no need to include the serviceID in the command
929+ fmt .Fprintf (output , "🔌 Run 'tiger db connect' to connect to your new service\n " )
930+ }
931+ }
932+
917933// buildServiceDeleteCmd creates the delete subcommand
918934func buildServiceDeleteCmd () * cobra.Command {
919935 var deleteNoWait bool
@@ -1294,7 +1310,7 @@ Examples:
12941310 }
12951311
12961312 // Save password immediately after service fork
1297- handlePasswordSaving (forkedService , initialPassword , statusOutput )
1313+ passwordSaved := handlePasswordSaving (forkedService , initialPassword , statusOutput )
12981314
12991315 // Set as default service unless --no-set-default is used
13001316 if ! forkNoSetDefault {
@@ -1316,6 +1332,7 @@ Examples:
13161332 return err
13171333 }
13181334 fmt .Fprintf (statusOutput , "🎉 Service fork completed successfully!\n " )
1335+ printConnectMessage (statusOutput , passwordSaved , forkNoSetDefault , serviceID )
13191336 return nil
13201337
13211338 case 401 :
0 commit comments