(commonFlags *secretsFlags)
| 167 | } |
| 168 | |
| 169 | func 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 | |
| 197 | func secretsUploadCmd(commonFlags *secretsFlags) *cobra.Command { |
| 198 | flags := &secretsUploadFlags{} |
no test coverage detected