Skip to content

Commit

Permalink
Warn if more than one command is used.
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Fontein <[email protected]>
  • Loading branch information
felixfontein committed Feb 6, 2024
1 parent f70e636 commit 37ee5c2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cmd/sops/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,23 @@ func main() {
fileNameOverride = fileName
}

commandCount := 0
if c.Bool("encrypt") {
commandCount++
}
if c.Bool("decrypt") {
commandCount++
}
if c.Bool("rotate") {
commandCount++
}
if c.String("set") != "" {
commandCount++
}
if commandCount > 1 {
log.Warn("More than one command (--encrypt, --decrypt, --rotate, --set) has been specified. Only the changes made by the last one will be visible. Note that this behavior is deprecated and will cause an error eventually.")
}

unencryptedSuffix := c.String("unencrypted-suffix")
encryptedSuffix := c.String("encrypted-suffix")
encryptedRegex := c.String("encrypted-regex")
Expand Down

0 comments on commit 37ee5c2

Please sign in to comment.