Skip to content

Commit 5145c62

Browse files
author
Alexis Sellier
committed
fix: do not exit too soon if a dev config has no Ports when running list ports
Signed-off-by: Alexis Sellier <alexis.sellier@ankorstore.com>
1 parent 8c3c46f commit 5145c62

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

cmd/list/ports.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package list
22

33
import (
44
"context"
5+
56
"github.com/loft-sh/devspace/cmd/flags"
67
"github.com/loft-sh/devspace/pkg/util/factory"
78
"github.com/loft-sh/devspace/pkg/util/log"
@@ -57,8 +58,7 @@ func (cmd *portsCmd) RunListPort(f factory.Factory, cobraCmd *cobra.Command, arg
5758
portForwards := make([][]string, 0)
5859
for _, dev := range config.Dev {
5960
if dev.Ports == nil || len(dev.Ports) == 0 {
60-
logger.Info("No ports are forwarded.\n")
61-
return nil
61+
continue
6262
}
6363
selector := ""
6464
for k, v := range dev.LabelSelector {
@@ -76,7 +76,10 @@ func (cmd *portsCmd) RunListPort(f factory.Factory, cobraCmd *cobra.Command, arg
7676
})
7777
}
7878
}
79-
79+
if len(portForwards) == 0 {
80+
logger.Info("No ports are forwarded.\n")
81+
return nil
82+
}
8083
headerColumnNames := []string{
8184
"ImageSelector",
8285
"LabelSelector",

0 commit comments

Comments
 (0)