Add $PASSWORD_STORE_DIR support to pass for XDG (#182)

pass has partial support for the XDG Base Directory specification. The most
common value for PASSWORD_STORE_DIR is either unset or
$XDG_DATA_DIR/password-store

See the man page of pass for more details:
https://git.zx2c4.com/password-store/about/#ENVIRONMENT%20VARIABLES
This commit is contained in:
Spenser Truex 2020-03-26 18:04:36 -07:00 committed by GitHub
parent dd5b037923
commit d337cfccf5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View file

@ -3,5 +3,5 @@
:description "Integrate 'pass' with StumpWM"
:author "Florian Margaine <florian@margaine.com>"
:license "GPLv3"
:depends-on (:stumpwm)
:depends-on (:stumpwm :uiop)
:components ((:file "pass")))

View file

@ -1,10 +1,16 @@
(defpackage #:pass
(:use #:cl)
(:export *password-store*))
(:export #:*password-store*)
(:import-from #:uiop #:getenv-absolute-directory))
(in-package #:pass)
(defvar *password-store* (merge-pathnames #p".password-store/" (user-homedir-pathname)))
(defvar *password-store*
(or (getenv-absolute-directory "PASSWORD_STORE_DIR")
(merge-pathnames #p".password-store/"
(user-homedir-pathname)))
"Location to search for names in the password store, according to the XDG Base
Directory Specification. Tries $PASSWORD_STORE_DIR then $HOME/.password-store/.")
(defun pass-entries ()
(let ((home-ns-len (length (namestring *password-store*))))