dotfiles/.local/bin/passmenu2

27 lines
525 B
Bash
Executable File

#!/usr/bin/env bash
shopt -s nullglob globstar
STARTDIR=${PASSWORD_STORE_DIR-~/.password-store}
BASEDIR=$STARTDIR
DONE=0
LEVEL=0
SELECTION=""
while [ "$DONE" -eq 0 ] ; do
password_files=( `find "$STARTDIR" -name "*.gpg" | sed -e 's/\.gpg//' -e 's#^.*password-store/##' ` )
entry=$(printf '%s\n' "${password_files[@]}" | dmenu -i "$@" -l 15)
echo "entry: $entry"
if [ -z "$entry" ] ; then
DONE=1
exit
fi
SELECTION="$SELECTION/$entry"
pass show "$SELECTION" | xclip -r -sel clip
DONE=1
done