Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added --yes flat to config pull to skip confirmation #791

Merged
merged 1 commit into from
Oct 18, 2023
Merged
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
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