sops icon indicating copy to clipboard operation
sops copied to clipboard

`--output-type` must appear before `-d`

Open spencerwilson opened this issue 2 years ago • 3 comments

On sops 3.7.3:

Expected

Given an encrypted .env file,

% sops -d secrets.enc.env --output-type json
<command prints secrets in the env file, but in a JSON object container instead>

Actual

% sops -d secrets.enc.env --output-type json
<command behaves as though `--output-type` was not given

Workaround

Moving --output-type json in front of -d <path> does work:

% sops --output-type json -d secrets.enc.env
<expected output as described above>

Not sure if this is expected behavior and thus a docs gap, or a bug. I'd guess the latter since sops --help says that everything is just a "global option" with no relative order required for them to work.

spencerwilson avatar Aug 14 '23 18:08 spencerwilson

I guess this is related to #598. There's a bunch of similar issues, most (or all?) of them closed linking to that one.

felixfontein avatar Aug 23 '23 05:08 felixfontein

Also please note that -d path are two separate options: a flag (-d) and a positional argument (path). All options must come before the positional arguments. So sops -d --output-type json secrets.enc.env will work as well.

felixfontein avatar Nov 05 '23 13:11 felixfontein

#1342 improves the situation by at least warning when this happens.

felixfontein avatar Nov 05 '23 14:11 felixfontein