1
0
mirror of https://github.com/octoleo/Purse.git synced 2024-10-18 01:46:30 +00:00

Merge pull request #10 from drduh/wip-fix-pwdsh-var

Fix var names from pwd.sh
This commit is contained in:
drduh 2024-07-04 23:30:55 +00:00 committed by GitHub
commit bb3a2fa88d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -12,8 +12,8 @@ today="$(date +%F)"
gpg="$(command -v gpg || command -v gpg2)" gpg="$(command -v gpg || command -v gpg2)"
gpg_conf="${HOME}/.gnupg/gpg.conf" gpg_conf="${HOME}/.gnupg/gpg.conf"
clip="${PWDSH_CLIP:=xclip}" # clipboard, 'pbcopy' on macOS clip="${PURSE_CLIP:=xclip}" # clipboard, 'pbcopy' on macOS
clip_args=${PWDSH_CLIP_ARGS:=} # args to pass to copy command clip_args=${PURSE_CLIP_ARGS:=} # args to pass to copy command
clip_dest="${PURSE_DEST:=clipboard}" # set to 'screen' to print to stdout clip_dest="${PURSE_DEST:=clipboard}" # set to 'screen' to print to stdout
clip_timeout="${PURSE_TIME:=10}" # seconds to clear clipboard/screen clip_timeout="${PURSE_TIME:=10}" # seconds to clear clipboard/screen
comment="${PURSE_COMMENT:=}" # *unencrypted* comment in files comment="${PURSE_COMMENT:=}" # *unencrypted* comment in files
@ -210,7 +210,7 @@ list_entry () {
backup () { backup () {
# Archive index, safe and configuration. # Archive index, safe and configuration.
if [[ ! -f ${safe_backup} ]] ; then if [[ ! -f "${safe_backup}" ]] ; then
if [[ -f "${safe_ix}" && -d "${safe_dir}" ]] ; then if [[ -f "${safe_ix}" && -d "${safe_dir}" ]] ; then
cp "${gpg_conf}" "gpg.conf.${today}" cp "${gpg_conf}" "gpg.conf.${today}"
tar cf "${safe_backup}" "${safe_dir}" "${safe_ix}" \ tar cf "${safe_backup}" "${safe_dir}" "${safe_ix}" \
@ -246,18 +246,15 @@ new_entry () {
Username (Enter to generate): " username Username (Enter to generate): " username
else username="${2}" ; fi else username="${2}" ; fi
if [[ -z "${username}" ]] ; then if [[ -z "${username}" ]] ; then
username=$(generate_user "$@") username=$(generate_user "$@") ; fi
fi
if [[ -z "${3+x}" ]] ; then if [[ -z "${3+x}" ]] ; then
get_pass "Password for \"${username}\" (Enter to generate): " get_pass "Password for \"${username}\" (Enter to generate): "
userpass="${password}" userpass="${password}" ; fi
fi
printf "\n" printf "\n"
if [[ -z "${password}" ]] ; then if [[ -z "${password}" ]] ; then
userpass=$(generate_pass "$@") userpass=$(generate_pass "$@") ; fi
fi
} }
print_help () { print_help () {