mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2026-03-20 01:37:45 +01:00
Add a better POSIX compliant way of getting a list of passwords
This commit is contained in:
parent
2fa2c328cc
commit
fa9ba1d263
@ -3,7 +3,7 @@
|
||||
totp_tmp="${XDG_CACHE_HOME:-$HOME/.cache}/totp-tmp.png"
|
||||
|
||||
getPasswords() {
|
||||
choice="$(pass | sed -E "1d;s/(└|├|─|─ )//g" | grep -v "totp" | dmenu -i -p "Passwords")"
|
||||
choice="$(find "${PASSWORD_STORE_DIR--~/.password-store}" -type f | sed "s|${PASSWORD_STORE_DIR-~/.password-store}/|| ; s/.gpg$// ; /.gpg-id/d" | sort | grep -v "totp" | dmenu -i -p "Passwords")"
|
||||
|
||||
[ -z "$choice" ] && exit
|
||||
|
||||
@ -11,7 +11,7 @@ getPasswords() {
|
||||
}
|
||||
|
||||
getTOTP() {
|
||||
choice="$(pass | sed -E "1d;s/(└|├|─|─ )//g" | grep "totp" | dmenu -i -p "OTP")"
|
||||
choice="$(find "${PASSWORD_STORE_DIR--~/.password-store}" -type f | sed "s|${PASSWORD_STORE_DIR-~/.password-store}/|| ; s/.gpg$// ; /.gpg-id/d" | sort | grep "totp" | dmenu -i -p "OTP")"
|
||||
|
||||
[ -z "$choice" ] && exit
|
||||
|
||||
@ -40,15 +40,15 @@ addPassword() {
|
||||
|
||||
case "$(printf "Random password\\nManual password" | dmenu -i -p "Passwords")" in
|
||||
"Random password")
|
||||
case "$(printf "Simple\\nComplex" | dmenu -i -p "Passwords")" in
|
||||
"Simple")
|
||||
addPass=$(tr -dc 'A-Za-z0-9' </dev/urandom |
|
||||
head -c "$(printf "12\\n32\\n128" |
|
||||
dmenu -i -p "How many characters?")" ; echo) ;;
|
||||
case "$(printf "Complex\\nSimple" | dmenu -i -p "Passwords")" in
|
||||
"Complex")
|
||||
addPass=$(tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' </dev/urandom | \
|
||||
head -c "$(printf "12\\n32\\n128" |
|
||||
dmenu -i -p "How many characters?")" ; echo) ;;
|
||||
"Simple")
|
||||
addPass=$(tr -dc 'A-Za-z0-9' </dev/urandom |
|
||||
head -c "$(printf "12\\n32\\n128" |
|
||||
dmenu -i -p "How many characters?")" ; echo) ;;
|
||||
* ) exit ;;
|
||||
esac ;;
|
||||
"Manual password") addPass=$(dmenu -i -P -p "Enter a password") ;;
|
||||
@ -62,7 +62,7 @@ addPassword() {
|
||||
}
|
||||
|
||||
removePassword() {
|
||||
name="$(pass | sed -E "1d;s/(└|├|─|─ )//g" | dmenu -i -p "Passwords")"
|
||||
name="$(find "${PASSWORD_STORE_DIR--~/.password-store}" -type f | sed "s|${PASSWORD_STORE_DIR-~/.password-store}/|| ; s/.gpg$// ; /.gpg-id/d" | sort | dmenu -i -p "Passwords")"
|
||||
|
||||
[ -z "$name" ] && exit
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user