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

supabase / cli / 20065213712

09 Dec 2025 01:30PM UTC coverage: 56.212% (+0.03%) from 56.185%
20065213712

Pull #4598

github

web-flow
Merge 783fdacae into e43638018
Pull Request #4598: refactor(cli): move Deno/IntelliJ prompts from init to functions new

35 of 45 new or added lines in 4 files covered. (77.78%)

6 existing lines in 2 files now uncovered.

6832 of 12154 relevant lines covered (56.21%)

6.31 hits per line

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

0.0
/cmd/init.go
1
package cmd
2

3
import (
4
        "fmt"
5

6
        "github.com/spf13/afero"
7
        "github.com/spf13/cobra"
8
        "github.com/spf13/viper"
9
        _init "github.com/supabase/cli/internal/init"
10
        "github.com/supabase/cli/internal/utils"
11
)
12

13
var (
14
        createVscodeSettings   = new(bool)
15
        createIntellijSettings = new(bool)
16
        initParams             = utils.InitParams{}
17

18
        initCmd = &cobra.Command{
19
                GroupID: groupLocalDev,
20
                Use:     "init",
21
                Short:   "Initialize a local project",
22
                PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
×
23
                        if !viper.IsSet("WORKDIR") {
×
24
                                // Prevents recursing to parent directory
×
25
                                viper.Set("WORKDIR", ".")
×
26
                        }
×
27
                        return cmd.Root().PersistentPreRunE(cmd, args)
×
28
                },
29
                PreRun: func(cmd *cobra.Command, args []string) {
×
30
                        if initParams.UseOrioleDB {
×
31
                                cobra.CheckErr(cmd.MarkFlagRequired("experimental"))
×
32
                        }
×
33
                },
34
                RunE: func(cmd *cobra.Command, args []string) error {
×
35
                        fsys := afero.NewOsFs()
×
36
                        if !cmd.Flags().Changed("with-vscode-settings") && !cmd.Flags().Changed("with-vscode-workspace") {
×
37
                                createVscodeSettings = nil
×
38
                        }
×
39

40
                        if !cmd.Flags().Changed("with-intellij-settings") {
×
41
                                createIntellijSettings = nil
×
42
                        }
×
NEW
43
                        return _init.Run(fsys, createVscodeSettings, createIntellijSettings, initParams)
×
44
                },
45
                PostRun: func(cmd *cobra.Command, args []string) {
×
46
                        fmt.Println("Finished " + utils.Aqua("supabase init") + ".")
×
47
                },
×
48
        }
49
)
50

51
func init() {
×
52
        flags := initCmd.Flags()
×
53
        flags.BoolVar(createVscodeSettings, "with-vscode-workspace", false, "Generate VS Code workspace.")
×
54
        cobra.CheckErr(flags.MarkHidden("with-vscode-workspace"))
×
55
        flags.BoolVar(createVscodeSettings, "with-vscode-settings", false, "Generate VS Code settings for Deno.")
×
56
        flags.BoolVar(createIntellijSettings, "with-intellij-settings", false, "Generate IntelliJ IDEA settings for Deno.")
×
57
        flags.BoolVar(&initParams.UseOrioleDB, "use-orioledb", false, "Use OrioleDB storage engine for Postgres.")
×
58
        flags.BoolVar(&initParams.Overwrite, "force", false, "Overwrite existing "+utils.ConfigPath+".")
×
59
        rootCmd.AddCommand(initCmd)
×
60
}
×
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