pash: simplify password show

This commit is contained in:
Dylan Araps 2019-11-28 18:42:28 +00:00
parent 225880b889
commit f07b3145a0
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 2 additions and 7 deletions

9
pash
View File

@ -56,16 +56,11 @@ pw_del() {
} }
pw_show() { pw_show() {
pass=$("$gpg" -dq "$1.gpg") "$gpg" -dq "$1.gpg"
# If '$2' is defined, don't print the password to the
# terminal. For example, this is used when the password is
# copied to the clipboard.
[ "$2" ] || printf '%s\n' "$pass"
} }
pw_copy() { pw_copy() {
pw_show "$1" copy pass=$(pw_show "$1")
# Disable warning against words-splitting as it is safe # Disable warning against words-splitting as it is safe
# and intentional (globbing is disabled). # and intentional (globbing is disabled).