MCPcopy Create free account
hub / github.com/rilldata/rill / PullCmd

Function PullCmd

cli/cmd/env/pull.go:17–47  ·  view source on GitHub ↗
(ch *cmdutil.Helper)

Source from the content-addressed store, hash-verified

15)
16
17func PullCmd(ch *cmdutil.Helper) *cobra.Command {
18 var projectPath, projectName, environment string
19
20 pullCmd := &cobra.Command{
21 Use: "pull [<project-name>]",
22 Short: "Pull cloud credentials into local .env file",
23 RunE: func(cmd *cobra.Command, args []string) error {
24 // If projectPath is provided, normalize it
25 if projectPath != "" {
26 var err error
27 projectPath, err = normalizeProjectPath(projectPath)
28 if err != nil {
29 return err
30 }
31 }
32
33 if len(args) > 0 {
34 projectName = args[0]
35 }
36
37 // Fetch the project variables from the cloud
38 return PullVars(cmd.Context(), ch, projectPath, projectName, environment, true)
39 },
40 }
41
42 pullCmd.Flags().StringVar(&projectPath, "path", ".", "Project directory")
43 pullCmd.Flags().StringVar(&projectName, "project", "", "Cloud project name (will attempt to infer from Git remote if not provided)")
44 pullCmd.Flags().StringVar(&environment, "environment", "dev", "Environment to resolve for (options: dev, prod)")
45
46 return pullCmd
47}
48
49func PullVars(ctx context.Context, ch *cmdutil.Helper, projectPath, projectName, environment string, warnForNoVars bool) error {
50 // Parse and verify the project directory

Callers 1

EnvCmdFunction · 0.85

Calls 3

normalizeProjectPathFunction · 0.85
PullVarsFunction · 0.85
ContextMethod · 0.65

Tested by

no test coverage detected