NewEncryptCommand creates and returns the cobra command for encrypting config passwords.
()
| 30 | |
| 31 | // NewEncryptCommand creates and returns the cobra command for encrypting config passwords. |
| 32 | func NewEncryptCommand() *cobra.Command { |
| 33 | cmd := &cobra.Command{ |
| 34 | Use: "encrypt", |
| 35 | Short: "Encrypt passwords in the configuration file", |
| 36 | Long: "Encrypt all plaintext passwords in the configuration file using a master password. Encrypted passwords are prefixed with 'enc:'.", |
| 37 | Run: func(_ *cobra.Command, _ []string) { |
| 38 | runEncrypt() |
| 39 | }, |
| 40 | } |
| 41 | return cmd |
| 42 | } |
| 43 | |
| 44 | func runEncrypt() { |
| 45 | // Check if env var is already set — skip interactive prompt |