MCPcopy Create free account
hub / github.com/nhost/nhost / commandPull

Function commandPull

cli/cmd/config/pull.go:50–83  ·  view source on GitHub ↗
(ctx context.Context, cmd *cli.Command)

Source from the content-addressed store, hash-verified

48}
49
50func commandPull(ctx context.Context, cmd *cli.Command) error {
51 ce := clienv.FromCLI(cmd)
52
53 if !clienv.PathExists(ce.Path.NhostFolder()) {
54 return errors.New( //nolint:err113
55 "nhost folder not found. Please run `nhost init --remote` first to initialize your project",
56 )
57 }
58
59 skipConfirmation := cmd.Bool(flagYes)
60
61 if !skipConfirmation {
62 if err := verifyFile(ce, ce.Path.NhostToml()); err != nil {
63 return err
64 }
65 }
66
67 writeSecrets := true
68
69 if !skipConfirmation {
70 if err := verifyFile(ce, ce.Path.Secrets()); err != nil {
71 writeSecrets = false
72 }
73 }
74
75 proj, err := ce.GetAppInfo(ctx, cmd.String(flagSubdomain))
76 if err != nil {
77 return fmt.Errorf("failed to get app info: %w", err)
78 }
79
80 _, err = Pull(ctx, ce, proj, writeSecrets)
81
82 return err
83}
84
85func verifyFile(ce *clienv.CliEnv, name string) error {
86 if clienv.PathExists(name) {

Callers

nothing calls this directly

Calls 10

FromCLIFunction · 0.92
PathExistsFunction · 0.92
verifyFileFunction · 0.85
PullFunction · 0.85
NhostFolderMethod · 0.80
NhostTomlMethod · 0.80
SecretsMethod · 0.80
GetAppInfoMethod · 0.80
ErrorfMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected