Function: sops--filestatus

sops--filestatus is a natively compiled function defined in sops.el.

Signature

(sops--filestatus FILE)

Documentation

Return t if FILE is sops-encrypted, nil otherwise.

Threads sops-input-type-overrides as --input-type if matched.

A nil return means "not known to be encrypted" -- sops errored, the file is unreadable, the JSON parse failed, or the file is genuinely plaintext. Callers must not treat nil as a positive plaintext signal; only treat t as a positive encrypted signal.

Source Code

;; Defined in /nix/store/vihl6lkzddv9xrsrsznvqdjq27g2i30p-emacs-packages-deps/share/emacs/site-lisp/elpa/sops-20260920.2121/sops.el
(defun sops--filestatus (file)
  "Return t if FILE is sops-encrypted, nil otherwise.
Threads `sops-input-type-overrides' as `--input-type' if matched.

A nil return means \"not known to be encrypted\" -- sops errored, the
file is unreadable, the JSON parse failed, or the file is genuinely
plaintext.  Callers must not treat nil as a positive plaintext signal;
only treat t as a positive encrypted signal."
  (let* ((input-type (sops--input-type-for file))
         (args (append '("filestatus")
                       (when input-type (list "--input-type" input-type))
                       (list file)))
         (result (sops--run args)))
    (and (eq 0 (plist-get result :exit-status))
         (sops--parse-filestatus (plist-get result :stdout)))))