diff --git a/scripts/wpass b/scripts/wpass index 2b6240e..90a9d44 100755 --- a/scripts/wpass +++ b/scripts/wpass @@ -18,6 +18,13 @@ print_actions_for_entry() { if test -n "$otp"; then echo "OTP" fi + + echo "$entry_content" | \ + rg '^(\w+): .*$' --replace '$1' | \ + sed \ + -e '/login/d' \ + -e '/user/d' \ + -e '/email/d' } main() { @@ -29,8 +36,9 @@ main() { test -n "$entry" || exit 0 - username=`pass show "$entry" 2>/dev/null | rg -m1 '(login|user|email): (.*)' -r '$2'` || true - password=`pass show "$entry" 2>/dev/null | head -n 1` || true + entry_content="$(pass show "$entry" 2>/dev/null)" || true + username=`echo "$entry_content" | rg -m1 '(login|user|email): (.*)' -r '$2'` || true + password=`echo "$entry_content" | head -n 1` || true otp=`pass otp "$entry" 2>/dev/null` || true action="$(print_actions_for_entry | wdmenu -p Action)" @@ -45,6 +53,10 @@ main() { printf '%s' "$password" | wl-copy;; OTP) pass otp "$entry" | wl-copy;; + *) + key="$action" + printf '%s\n' "$entry_content" | rg -m1 "^$key: (.*)" -r '$1' | wl-copy -n + ;; esac }