refactor: subcommands (#1111)

This commit is contained in:
Jonas Plum
2024-11-06 01:21:31 +01:00
committed by GitHub
parent 38a89f2c94
commit d1cf75ab79
5 changed files with 39 additions and 56 deletions

View File

@@ -6,7 +6,6 @@ import (
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/models"
"github.com/spf13/cobra"
"github.com/SecurityBrewery/catalyst/migrations"
)
@@ -85,35 +84,3 @@ func SetFlags(app core.App, args []string) error {
return nil
}
func setFeatureFlagsCmd(app core.App) *cobra.Command {
return &cobra.Command{
Use: "set-feature-flags",
Run: func(_ *cobra.Command, args []string) {
if err := SetFlags(app, args); err != nil {
app.Logger().Error(err.Error())
}
},
}
}
func setAppURL(app core.App) *cobra.Command {
return &cobra.Command{
Use: "set-app-url",
Run: func(_ *cobra.Command, args []string) {
if len(args) != 1 {
app.Logger().Error("missing app url")
return
}
settings := app.Settings()
settings.Meta.AppUrl = args[0]
if err := app.Dao().SaveSettings(settings); err != nil {
app.Logger().Error(err.Error())
}
},
}
}