Update 2023-04-26 12:31 OpenBSD/amd64-dalek

This commit is contained in:
c0dev0id 2023-04-26 12:31:59 +02:00
parent be5fb0ac65
commit df6a8787dd

View File

@ -4,15 +4,41 @@ shopt -s nullglob globstar
prefix=${PASSWORD_STORE_DIR-~/.password-store}
password_files=( "$prefix"/**/*.gpg )
password_files=( "${password_files[@]#"$prefix"/}" )
password_files=( "${password_files[@]%.gpg}" )
while true
do
password=$(printf '%s\n' "${password_files[@]}" | fzf)
[[ -n $password ]] || exit
pass edit "$password"
unset password_files;
password_files=( "$prefix"/**/*.gpg )
password_files=( "${password_files[@]#"$prefix"/}" )
password_files=( "${password_files[@]%.gpg}" )
password=$(printf '%s\n' "${password_files[@]}" | fzf -i $EXTRA --preview="pass {1}")
[[ -n "$password" ]] || exit
EXTRA="-q ${password#*/}"
echo "---------"
echo "Selected: $password"
PASS="$(pass "$password")"
echo "Password: $(echo "$PASS" | head -1)"
echo "$PASS" | grep -i "^username:"
echo "$PASS" | grep -i "^email:"
echo "$PASS" | grep -i "^url:"
echo "---------"
echo -n "[E]dit [R]ename [N]ew [D]elete: "
read
case $REPLY in
[eE]) echo "Editing $password."; pass edit "$password"; ;;
[rR]) echo -n "Rename to: "; read; [ ! -z "$REPLY" ] && pass mv "$password" "$REPLY"; ;;
[nN]) pass generate -i "$password" 22; ;;
[dD]) pass rm "$password"; unset EXTRA; ;;
esac
echo
echo "Press any key to continue"
read
done