Skip to content

Commit

Permalink
feat: added --yes flag to config pull to skip confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarrosop committed Oct 13, 2023
1 parent 7bad17e commit 058e5e3
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions cmd/config/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ const (
DefaultNhostWebhookSecret = "nhost-webhook-secret" //nolint:gosec
)

const (
flagYes = "yes"
)

func CommandPull() *cli.Command {
return &cli.Command{ //nolint:exhaustruct
Name: "pull",
Expand All @@ -34,20 +38,31 @@ func CommandPull() *cli.Command {
Usage: "Pull this subdomain's configuration. Defaults to linked project",
EnvVars: []string{"NHOST_SUBDOMAIN"},
},
&cli.BoolFlag{ //nolint:exhaustruct
Name: flagYes,
Usage: "Skip confirmation",
EnvVars: []string{"NHOST_YES"},
},
},
}
}

func commandPull(cCtx *cli.Context) error {
ce := clienv.FromCLI(cCtx)

if err := verifyFile(ce, ce.Path.NhostToml()); err != nil {
return err
skipConfirmation := cCtx.Bool(flagYes)

if !skipConfirmation {
if err := verifyFile(ce, ce.Path.NhostToml()); err != nil {
return err
}
}

writeSecrets := true
if err := verifyFile(ce, ce.Path.Secrets()); err != nil {
writeSecrets = false
if !skipConfirmation {
if err := verifyFile(ce, ce.Path.Secrets()); err != nil {
writeSecrets = false
}
}

proj, err := ce.GetAppInfo(cCtx.Context, cCtx.String(flagSubdomain))
Expand Down

0 comments on commit 058e5e3

Please sign in to comment.