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

supabase / cli / 20128715106

11 Dec 2025 09:43AM UTC coverage: 56.046% (-0.2%) from 56.237%
20128715106

Pull #4606

github

web-flow
Merge e5bcc615b into f513dbecb
Pull Request #4606: refactor(cli): replace IDE flags with interactive mode in init

12 of 44 new or added lines in 4 files covered. (27.27%)

13 existing lines in 3 files now uncovered.

6813 of 12156 relevant lines covered (56.05%)

6.29 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
        "os"
6

7
        "github.com/spf13/afero"
8
        "github.com/spf13/cobra"
9
        "github.com/spf13/viper"
10
        _init "github.com/supabase/cli/internal/init"
11
        "github.com/supabase/cli/internal/utils"
12
        "golang.org/x/term"
13
)
14

15
var (
16
        initInteractive        bool
17
        createVscodeSettings   bool
18
        createIntellijSettings bool
19
        initParams             = utils.InitParams{}
20

21
        initCmd = &cobra.Command{
22
                GroupID: groupLocalDev,
23
                Use:     "init",
24
                Short:   "Initialize a local project",
25
                PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
×
26
                        if !viper.IsSet("WORKDIR") {
×
27
                                // Prevents recursing to parent directory
×
28
                                viper.Set("WORKDIR", ".")
×
29
                        }
×
30
                        return cmd.Root().PersistentPreRunE(cmd, args)
×
31
                },
32
                PreRun: func(cmd *cobra.Command, args []string) {
×
33
                        if initParams.UseOrioleDB {
×
34
                                cobra.CheckErr(cmd.MarkFlagRequired("experimental"))
×
35
                        }
×
36
                },
37
                RunE: func(cmd *cobra.Command, args []string) error {
×
NEW
38
                        ctx := cmd.Context()
×
39
                        fsys := afero.NewOsFs()
×
NEW
40
                        interactive := initInteractive && term.IsTerminal(int(os.Stdin.Fd()))
×
NEW
41
                        if err := _init.Run(ctx, fsys, interactive, initParams); err != nil {
×
NEW
42
                                return err
×
UNCOV
43
                        }
×
44
                        // Handle backwards compatibility flags
NEW
45
                        if createVscodeSettings {
×
NEW
46
                                if err := _init.WriteVscodeConfig(fsys); err != nil {
×
NEW
47
                                        return err
×
NEW
48
                                }
×
49
                        }
NEW
50
                        if createIntellijSettings {
×
NEW
51
                                if err := _init.WriteIntelliJConfig(fsys); err != nil {
×
NEW
52
                                        return err
×
NEW
53
                                }
×
54
                        }
NEW
55
                        return nil
×
56
                },
57
                PostRun: func(cmd *cobra.Command, args []string) {
×
58
                        fmt.Println("Finished " + utils.Aqua("supabase init") + ".")
×
59
                },
×
60
        }
61
)
62

63
func init() {
×
64
        flags := initCmd.Flags()
×
NEW
65
        flags.BoolVarP(&initInteractive, "interactive", "i", false, "Enables interactive mode to configure IDE settings.")
×
66
        flags.BoolVar(&initParams.UseOrioleDB, "use-orioledb", false, "Use OrioleDB storage engine for Postgres.")
×
67
        flags.BoolVar(&initParams.Overwrite, "force", false, "Overwrite existing "+utils.ConfigPath+".")
×
NEW
68
        // Backwards compatibility flags (hidden)
×
NEW
69
        flags.BoolVar(&createVscodeSettings, "with-vscode-workspace", false, "Generate VS Code workspace.")
×
NEW
70
        cobra.CheckErr(flags.MarkHidden("with-vscode-workspace"))
×
NEW
71
        flags.BoolVar(&createVscodeSettings, "with-vscode-settings", false, "Generate VS Code settings for Deno.")
×
NEW
72
        cobra.CheckErr(flags.MarkHidden("with-vscode-settings"))
×
NEW
73
        flags.BoolVar(&createIntellijSettings, "with-intellij-settings", false, "Generate IntelliJ IDEA settings for Deno.")
×
NEW
74
        cobra.CheckErr(flags.MarkHidden("with-intellij-settings"))
×
75
        rootCmd.AddCommand(initCmd)
×
76
}
×
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