sops
sops copied to clipboard
(feat) make noise instead of ignoring flags passed behind filename
This command will silently ignore the --output
flag and its passed value.
sops -d encrypted_secret.json --output decrypted_secret.json
I think it would make sense to let this error instead, otherwise issues like https://github.com/mozilla/sops/issues/658#issuecomment-617873253 will show up.
Happy to take a PR for this, but it seems hard to do since effectively to detect this, you have to write the same code it'd take to let flags be specified after the file name
Yeah adding lots of logic just for this in the code base would be a mess, I expect to get this out of the box of the command line flag parsing library or something that can be configured by that library.
https://github.com/mozilla/sops/blob/38b25bd449619e1d6da20e637702f7c73203aa44/cmd/sops/main.go#L40
It seems like there is a new version of this library, the v2
, and it has notes about how to upgrade regarding this specifically. See https://github.com/urfave/cli/blob/master/docs/migrate-v1-to-v2.md#flags-before-args.
I also ran into this when playing with --input-type
and --output-type
. After some time I noticed I had to put them before the filename to get any result :)
yep hit this. Minimally would be helpful to note in the --help for --output
or the README https://github.com/mozilla/sops#217saving-output-to-a-file