Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions cmd/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package cmd
import (
"context"
"fmt"
"os"
"os/signal"
"strings"

"github.com/go-errors/errors"
Expand All @@ -28,7 +26,7 @@ var (
Short: "Bootstrap a Supabase project from a starter template",
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
ctx, _ := signal.NotifyContext(cmd.Context(), os.Interrupt)
ctx := cmd.Context()
if !viper.IsSet("WORKDIR") {
title := fmt.Sprintf("Enter a directory to bootstrap your project (or leave blank to use %s): ", utils.Bold(utils.CurrentDirAbs))
if workdir, err := utils.NewConsole().PromptText(ctx, title); err != nil {
Expand Down
6 changes: 0 additions & 6 deletions cmd/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package cmd
import (
"fmt"
"os"
"os/signal"
"path/filepath"

"github.com/spf13/afero"
Expand Down Expand Up @@ -31,11 +30,6 @@ var (
GroupID: groupLocalDev,
Use: "db",
Short: "Manage Postgres databases",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
ctx, _ := signal.NotifyContext(cmd.Context(), os.Interrupt)
cmd.SetContext(ctx)
return cmd.Root().PersistentPreRunE(cmd, args)
},
}

dbBranchCmd = &cobra.Command{
Expand Down
3 changes: 1 addition & 2 deletions cmd/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package cmd
import (
"encoding/json"
"os"
"os/signal"
"strings"
"time"

Expand Down Expand Up @@ -88,7 +87,7 @@ var (
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
ctx, _ := signal.NotifyContext(cmd.Context(), os.Interrupt)
ctx := cmd.Context()
if flags.DbConfig.Host == "" {
// If no flag is specified, prompt for project id.
if err := flags.ParseProjectRef(ctx, afero.NewMemMapFs()); errors.Is(err, utils.ErrNotLinked) {
Expand Down
8 changes: 0 additions & 8 deletions cmd/inspect.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package cmd

import (
"os"
"os/signal"

"github.com/spf13/afero"
"github.com/spf13/cobra"
"github.com/supabase/cli/internal/inspect"
Expand Down Expand Up @@ -33,11 +30,6 @@ var (
inspectDBCmd = &cobra.Command{
Use: "db",
Short: "Tools to inspect your Supabase database",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
ctx, _ := signal.NotifyContext(cmd.Context(), os.Interrupt)
cmd.SetContext(ctx)
return cmd.Root().PersistentPreRunE(cmd, args)
},
}

inspectDBStatsCmd = &cobra.Command{
Expand Down
3 changes: 1 addition & 2 deletions cmd/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package cmd
import (
"fmt"
"os"
"os/signal"

"github.com/spf13/afero"
"github.com/spf13/cobra"
Expand All @@ -28,7 +27,7 @@ var (
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
ctx, _ := signal.NotifyContext(cmd.Context(), os.Interrupt)
ctx := cmd.Context()
// Use an empty fs to skip loading from file
if err := flags.ParseProjectRef(ctx, afero.NewMemMapFs()); err != nil {
return err
Expand Down
6 changes: 0 additions & 6 deletions cmd/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package cmd
import (
"fmt"
"os"
"os/signal"

"github.com/spf13/afero"
"github.com/spf13/cobra"
Expand All @@ -25,11 +24,6 @@ var (
Use: "migration",
Aliases: []string{"migrations"},
Short: "Manage database migration scripts",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
ctx, _ := signal.NotifyContext(cmd.Context(), os.Interrupt)
cmd.SetContext(ctx)
return cmd.Root().PersistentPreRunE(cmd, args)
},
}

migrationListCmd = &cobra.Command{
Expand Down
3 changes: 1 addition & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ var (
}
cmd.SilenceUsage = true
// Load profile before changing workdir
ctx := cmd.Context()
ctx, _ := signal.NotifyContext(cmd.Context(), os.Interrupt)
fsys := afero.NewOsFs()
if err := utils.LoadProfile(ctx, fsys); err != nil {
return err
Expand All @@ -106,7 +106,6 @@ var (
if err := promptLogin(fsys); err != nil {
return err
}
ctx, _ = signal.NotifyContext(ctx, os.Interrupt)
if cmd.Flags().Lookup("project-ref") != nil {
if err := flags.ParseProjectRef(ctx, fsys); err != nil {
return err
Expand Down
8 changes: 0 additions & 8 deletions cmd/seed.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package cmd

import (
"os"
"os/signal"

"github.com/spf13/afero"
"github.com/spf13/cobra"
"github.com/supabase/cli/internal/seed/buckets"
Expand All @@ -16,11 +13,6 @@ var (
GroupID: groupLocalDev,
Use: "seed",
Short: "Seed a Supabase project from " + utils.ConfigPath,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
ctx, _ := signal.NotifyContext(cmd.Context(), os.Interrupt)
cmd.SetContext(ctx)
return cmd.Root().PersistentPreRunE(cmd, args)
},
}

bucketsCmd = &cobra.Command{
Expand Down
6 changes: 1 addition & 5 deletions cmd/status.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package cmd

import (
"os"
"os/signal"

env "github.com/Netflix/go-env"
"github.com/spf13/afero"
"github.com/spf13/cobra"
Expand All @@ -27,8 +24,7 @@ var (
return env.Unmarshal(es, &names)
},
RunE: func(cmd *cobra.Command, args []string) error {
ctx, _ := signal.NotifyContext(cmd.Context(), os.Interrupt)
return status.Run(ctx, names, utils.OutputFormat.Value, afero.NewOsFs())
return status.Run(cmd.Context(), names, utils.OutputFormat.Value, afero.NewOsFs())
},
Example: ` supabase status -o env --override-name api.url=NEXT_PUBLIC_SUPABASE_URL
supabase status -o json`,
Expand Down
6 changes: 1 addition & 5 deletions cmd/stop.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package cmd

import (
"os"
"os/signal"

"github.com/spf13/afero"
"github.com/spf13/cobra"
"github.com/supabase/cli/internal/stop"
Expand All @@ -19,8 +16,7 @@ var (
Use: "stop",
Short: "Stop all local Supabase containers",
RunE: func(cmd *cobra.Command, args []string) error {
ctx, _ := signal.NotifyContext(cmd.Context(), os.Interrupt)
return stop.Run(ctx, !noBackup, projectId, all, afero.NewOsFs())
return stop.Run(cmd.Context(), !noBackup, projectId, all, afero.NewOsFs())
},
}
)
Expand Down
6 changes: 1 addition & 5 deletions cmd/test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package cmd

import (
"os"
"os/signal"

"github.com/spf13/afero"
"github.com/spf13/cobra"
"github.com/supabase/cli/internal/test/new"
Expand Down Expand Up @@ -33,8 +30,7 @@ var (
Short: "Create a new test file",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
ctx, _ := signal.NotifyContext(cmd.Context(), os.Interrupt)
return new.Run(ctx, args[0], template.Value, afero.NewOsFs())
return new.Run(cmd.Context(), args[0], template.Value, afero.NewOsFs())
},
}
)
Expand Down
6 changes: 1 addition & 5 deletions cmd/unlink.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package cmd

import (
"os"
"os/signal"

"github.com/spf13/afero"
"github.com/spf13/cobra"
"github.com/supabase/cli/internal/unlink"
Expand All @@ -15,8 +12,7 @@ var (
Use: "unlink",
Short: "Unlink a Supabase project",
RunE: func(cmd *cobra.Command, args []string) error {
ctx, _ := signal.NotifyContext(cmd.Context(), os.Interrupt)
return unlink.Run(ctx, afero.NewOsFs())
return unlink.Run(cmd.Context(), afero.NewOsFs())
},
}
)
Expand Down