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

supabase / cli / 18403653021

10 Oct 2025 10:20AM UTC coverage: 54.315% (-0.4%) from 54.696%
18403653021

Pull #4283

github

web-flow
Merge d880548e0 into a250719cb
Pull Request #4283: feat: add command to clone project to local

14 of 107 new or added lines in 4 files covered. (13.08%)

23 existing lines in 2 files now uncovered.

6419 of 11818 relevant lines covered (54.32%)

6.04 hits per line

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

0.0
/cmd/clone.go
1
package cmd
2

3
import (
4
        "fmt"
5
        "os"
6
        "os/signal"
7

8
        "github.com/spf13/afero"
9
        "github.com/spf13/cobra"
10
        "github.com/spf13/viper"
11
        "github.com/supabase/cli/internal/clone"
12
        "github.com/supabase/cli/internal/utils"
13
        "github.com/supabase/cli/internal/utils/flags"
14
)
15

16
var (
17
        cloneCmd = &cobra.Command{
18
                GroupID: groupQuickStart,
19
                Use:     "clone",
20
                Short:   "Clones a Supabase project to your local environment",
21
                Args:    cobra.NoArgs,
NEW
22
                RunE: func(cmd *cobra.Command, args []string) error {
×
NEW
23
                        ctx, _ := signal.NotifyContext(cmd.Context(), os.Interrupt)
×
NEW
24
                        if !viper.IsSet("WORKDIR") {
×
NEW
25
                                title := fmt.Sprintf("Enter a directory to clone your project to (or leave blank to use %s): ", utils.Bold(utils.CurrentDirAbs))
×
NEW
26
                                if workdir, err := utils.NewConsole().PromptText(ctx, title); err != nil {
×
NEW
27
                                        return err
×
NEW
28
                                } else {
×
NEW
29
                                        viper.Set("WORKDIR", workdir)
×
NEW
30
                                }
×
31
                        }
NEW
32
                        return clone.Run(ctx, afero.NewOsFs())
×
33
                },
34
        }
35
)
36

NEW
37
func init() {
×
NEW
38
        cloneFlags := cloneCmd.Flags()
×
NEW
39
        cloneFlags.StringVar(&flags.ProjectRef, "project-ref", "", "Project ref of the Supabase project.")
×
NEW
40
        rootCmd.AddCommand(cloneCmd)
×
NEW
41
}
×
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