@@ -14,9 +14,10 @@ import (
1414)
1515
1616var (
17- singleline bool
18- skipUnchanged bool
19- tags map [string ]string
17+ singleline bool
18+ skipUnchanged bool
19+ tags map [string ]string
20+ preserveWriteCase bool
2021
2122 // writeCmd represents the write command
2223 writeCmd = & cobra.Command {
@@ -31,6 +32,7 @@ func init() {
3132 writeCmd .Flags ().BoolVarP (& singleline , "singleline" , "s" , false , "Insert single line parameter (end with \\ n)" )
3233 writeCmd .Flags ().BoolVarP (& skipUnchanged , "skip-unchanged" , "" , false , "Skip writing secret if value is unchanged" )
3334 writeCmd .Flags ().StringToStringVarP (& tags , "tags" , "t" , map [string ]string {}, "Add tags to the secret; new secrets only" )
35+ writeCmd .Flags ().BoolVarP (& preserveWriteCase , "preserve-case" , "p" , false , "preserve variable name case" )
3436 RootCmd .AddCommand (writeCmd )
3537}
3638
@@ -40,7 +42,12 @@ func write(cmd *cobra.Command, args []string) error {
4042 return fmt .Errorf ("Failed to validate service: %w" , err )
4143 }
4244
43- key := utils .NormalizeKey (args [1 ])
45+ key := args [1 ]
46+
47+ if ! preserveWriteCase {
48+ key = utils .NormalizeKey (key )
49+ }
50+
4451 if err := validateKey (key ); err != nil {
4552 return fmt .Errorf ("Failed to validate key: %w" , err )
4653 }
0 commit comments