| 90 | } |
| 91 | |
| 92 | func secretsSetCmd(flags *secretsFlags) *cobra.Command { |
| 93 | return &cobra.Command{ |
| 94 | Use: "set <NAME1>=<value1> [<NAME2>=<value2>]...", |
| 95 | Short: "Securely store one or more environment variables", |
| 96 | Long: "Securely store one or more environment variables. To test contents of a file as a secret use set=@<file>", |
| 97 | Args: cobra.MinimumNArgs(1), |
| 98 | PreRunE: func(cmd *cobra.Command, args []string) error { |
| 99 | return envsec.ValidateSetArgs(args) |
| 100 | }, |
| 101 | RunE: func(cmd *cobra.Command, args []string) error { |
| 102 | secrets, err := flags.envsec(cmd) |
| 103 | if err != nil { |
| 104 | return errors.WithStack(err) |
| 105 | } |
| 106 | |
| 107 | return secrets.SetFromArgs(cmd.Context(), args) |
| 108 | }, |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | func secretsRemoveCmd(flags *secretsFlags) *cobra.Command { |
| 113 | return &cobra.Command{ |