mirror of
https://github.com/silicoflare/envy.git
synced 2026-05-26 11:49:52 +05:30
feat: cant switch if only one env exists
This commit is contained in:
@@ -39,7 +39,10 @@ var switchCmd = &cobra.Command{
|
|||||||
envs, err := utils.GetEnvironments(dbProject.ID)
|
envs, err := utils.GetEnvironments(dbProject.ID)
|
||||||
utils.StopIfErr(err)
|
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 {
|
for _, en := range envs {
|
||||||
if en.Name != current {
|
if en.Name != current {
|
||||||
env = en.Name
|
env = en.Name
|
||||||
|
|||||||
Reference in New Issue
Block a user