Function: sops--maybe-output-type
sops--maybe-output-type is a natively compiled function defined in
sops.el.
Signature
(sops--maybe-output-type INPUT-TYPE EXISTING-ARGS)
Documentation
Return ("--output-type" INPUT-TYPE) to thread into a sops call, or nil.
Workaround for upstream sops bug: when --input-type overrides a
non-native extension (e.g. .txt), sops picks the *output* store
independently from the filename and falls back to the binary store,
which then can't dump a structured tree -- the user sees
"error emitting binary store: no binary data found in tree". See
getsops/sops#235 (closed without a code fix; the maintainers added
the error hint instead of inferring output-type from input-type).
Returns the pair only when INPUT-TYPE is non-nil and EXISTING-ARGS
doesn't already contain --output-type (so a user who explicitly
sets one wins). EXISTING-ARGS is the user-supplied args list this
call is being threaded into (sops-extra-decrypt-args for decrypt,
sops-extra-encrypt-args for encrypt).
Source Code
;; Defined in /nix/store/vihl6lkzddv9xrsrsznvqdjq27g2i30p-emacs-packages-deps/share/emacs/site-lisp/elpa/sops-20260920.2121/sops.el
(defun sops--maybe-output-type (input-type existing-args)
"Return `(\"--output-type\" INPUT-TYPE)' to thread into a sops call, or nil.
Workaround for upstream sops bug: when `--input-type' overrides a
non-native extension (e.g. `.txt'), sops picks the *output* store
independently from the filename and falls back to the binary store,
which then can't dump a structured tree -- the user sees
\"error emitting binary store: no binary data found in tree\". See
getsops/sops#235 (closed without a code fix; the maintainers added
the error hint instead of inferring output-type from input-type).
Returns the pair only when INPUT-TYPE is non-nil and EXISTING-ARGS
doesn't already contain `--output-type' (so a user who explicitly
sets one wins). EXISTING-ARGS is the user-supplied args list this
call is being threaded into (`sops-extra-decrypt-args' for decrypt,
`sops-extra-encrypt-args' for encrypt)."
(when (and input-type
(not (member "--output-type" existing-args)))
(list "--output-type" input-type)))