feat: cant switch if only one env exists

This commit is contained in:
2025-09-28 10:55:23 +05:30
parent cebe995c61
commit f96a917fea

View File

@@ -39,7 +39,10 @@ var switchCmd = &cobra.Command{
envs, err := utils.GetEnvironments(dbProject.ID)
utils.StopIfErr(err)
if len(envs) == 2 {
if len(envs) == 1 {
utils.ErrPrint("Cannot switch when there is only one environment.")
os.Exit(1)
} else if len(envs) == 2 {
for _, en := range envs {
if en.Name != current {
env = en.Name