MCPcopy Index your code
hub / github.com/jetify-com/devbox / secretsDownloadCmd

Function secretsDownloadCmd

internal/boxcli/secrets.go:169–195  ·  view source on GitHub ↗
(commonFlags *secretsFlags)

Source from the content-addressed store, hash-verified

167}
168
169func secretsDownloadCmd(commonFlags *secretsFlags) *cobra.Command {
170 flags := secretsDownloadFlags{}
171 command := &cobra.Command{
172 Use: "download <file1>",
173 Short: "Download environment variables into the specified file",
174 Args: cobra.ExactArgs(1),
175 PreRunE: func(cmd *cobra.Command, args []string) error {
176 return envsec.ValidateFormat(flags.format)
177 },
178 RunE: func(cmd *cobra.Command, args []string) error {
179 secrets, err := commonFlags.envsec(cmd)
180 if err != nil {
181 return errors.WithStack(err)
182 }
183 absPaths, err := fileutil.EnsureAbsolutePaths(args)
184 if err != nil {
185 return errors.WithStack(err)
186 }
187 return secrets.Download(cmd.Context(), absPaths[0], flags.format)
188 },
189 }
190
191 command.Flags().StringVarP(
192 &flags.format, "format", "f", "", "file format: dotenv or json")
193
194 return command
195}
196
197func secretsUploadCmd(commonFlags *secretsFlags) *cobra.Command {
198 flags := &secretsUploadFlags{}

Callers 1

secretsCmdFunction · 0.85

Calls 3

EnsureAbsolutePathsFunction · 0.92
envsecMethod · 0.80
DownloadMethod · 0.80

Tested by

no test coverage detected