wpass: allow copying arbitrary keys
This commit is contained in:
parent
eb5e752b44
commit
b5690aaaee
1 changed files with 14 additions and 2 deletions
|
|
@ -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
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue