21 lines
498 B
Bash
Executable File
21 lines
498 B
Bash
Executable File
#!/bin/zsh
|
|
|
|
PDIR="$(realpath ${PASSWORD_STORE_DIR:-~/.password-store})"
|
|
PCACHE="$(realpath ${XDG_CACHE_HOME:-~/.cache})/password-store-cache"
|
|
|
|
pcachegen() {
|
|
find "$PDIR" -name '*.gpg' | \
|
|
xargs -d'\n' realpath --relative-to="$PDIR" | \
|
|
sed 's/\.gpg$//g'
|
|
}
|
|
|
|
if [ -r "$PCACHE" ]; then
|
|
PLIST="$(cat "$PCACHE")"
|
|
else
|
|
PLIST="$(pcachegen)"
|
|
echo "$PLIST" > "$PCACHE"
|
|
fi
|
|
|
|
PASS="$(echo "$PLIST" | dmenu -i -l 30 -p 'Password/OTP')"
|
|
[ ! -z $PASS ] && pass $([ -z ${PASS#*/otp} ] && <<< otp) $PASS -c
|