• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / cli / 18484197182

14 Oct 2025 03:06AM UTC coverage: 54.597% (-0.09%) from 54.687%
18484197182

Pull #4306

github

web-flow
Merge 62a05d28d into 068afe697
Pull Request #4306: chore: modernise golang code

12 of 25 new or added lines in 14 files covered. (48.0%)

5 existing lines in 1 file now uncovered.

6390 of 11704 relevant lines covered (54.6%)

6.07 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/cmd/start.go
1
package cmd
2

3
import (
4
        "fmt"
5
        "os"
6
        "slices"
7
        "sort"
8
        "strings"
9

10
        "github.com/spf13/afero"
11
        "github.com/spf13/cobra"
12
        "github.com/supabase/cli/internal/start"
13
        "github.com/supabase/cli/internal/utils"
14
)
15

16
func validateExcludedContainers(excludedContainers []string) {
×
17
        // Validate excluded containers
×
18
        validContainers := start.ExcludableContainers()
×
19
        var invalidContainers []string
×
20

×
21
        for _, e := range excludedContainers {
×
NEW
22
                if !slices.Contains(validContainers, e) {
×
23
                        invalidContainers = append(invalidContainers, e)
×
24
                }
×
25
        }
26

27
        if len(invalidContainers) > 0 {
×
28
                // Sort the names list so it's easier to visually spot the one you looking for
×
29
                sort.Strings(validContainers)
×
30
                warning := fmt.Sprintf("%s The following container names are not valid to exclude: %s\nValid containers to exclude are: %s\n",
×
31
                        utils.Yellow("WARNING:"),
×
32
                        utils.Aqua(strings.Join(invalidContainers, ", ")),
×
33
                        utils.Aqua(strings.Join(validContainers, ", ")))
×
34
                fmt.Fprint(os.Stderr, warning)
×
35
        }
×
36
}
37

38
var (
39
        allowedContainers  = start.ExcludableContainers()
40
        excludedContainers []string
41
        ignoreHealthCheck  bool
42
        preview            bool
43

44
        startCmd = &cobra.Command{
45
                GroupID: groupLocalDev,
46
                Use:     "start",
47
                Short:   "Start containers for Supabase local development",
48
                RunE: func(cmd *cobra.Command, args []string) error {
×
49
                        validateExcludedContainers(excludedContainers)
×
50
                        return start.Run(cmd.Context(), afero.NewOsFs(), excludedContainers, ignoreHealthCheck)
×
51
                },
×
52
        }
53
)
54

55
func init() {
×
56
        flags := startCmd.Flags()
×
57
        names := strings.Join(allowedContainers, ",")
×
58
        flags.StringSliceVarP(&excludedContainers, "exclude", "x", []string{}, "Names of containers to not start. ["+names+"]")
×
59
        flags.BoolVar(&ignoreHealthCheck, "ignore-health-check", false, "Ignore unhealthy services and exit 0")
×
60
        flags.BoolVar(&preview, "preview", false, "Connect to feature preview branch")
×
61
        cobra.CheckErr(flags.MarkHidden("preview"))
×
62
        rootCmd.AddCommand(startCmd)
×
63
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc