aboutsummaryrefslogtreecommitdiff
path: root/.local/share/pass-extensions/directory.bash
diff options
context:
space:
mode:
Diffstat (limited to '.local/share/pass-extensions/directory.bash')
-rwxr-xr-x.local/share/pass-extensions/directory.bash12
1 files changed, 12 insertions, 0 deletions
diff --git a/.local/share/pass-extensions/directory.bash b/.local/share/pass-extensions/directory.bash
new file mode 100755
index 0000000..84db500
--- /dev/null
+++ b/.local/share/pass-extensions/directory.bash
@@ -0,0 +1,12 @@
+#!/bin/bash
+# print the initialized password store directory as a fully qualified path.
+# exits with code 1 if the password store is not initialized.
+dir="${PASSWORD_STORE_DIR-$HOME/.password-store}"
+dir="$(realpath "$dir")"
+if [ -e "$dir/.gpg-id" ] ; then
+ echo "$dir"
+else
+ echo "error: password store is not initialized" >&2
+ exit 1
+fi
+