github.com/supabase/cli@v1.168.1/internal/branches/update/update.go (about) 1 package update 2 3 import ( 4 "context" 5 "fmt" 6 7 "github.com/go-errors/errors" 8 "github.com/spf13/afero" 9 "github.com/supabase/cli/internal/utils" 10 "github.com/supabase/cli/pkg/api" 11 ) 12 13 func Run(ctx context.Context, branchId string, body api.UpdateBranchBody, fsys afero.Fs) error { 14 resp, err := utils.GetSupabase().UpdateBranchWithResponse(ctx, branchId, body) 15 if err != nil { 16 return errors.Errorf("failed to update preview branch: %w", err) 17 } 18 if resp.JSON200 == nil { 19 return errors.New("Unexpected error updating preview branch: " + string(resp.Body)) 20 } 21 fmt.Println("Updated preview branch:", resp.JSON200.Id) 22 return nil 23 }