Update more scripts to be just scripts
This commit is contained in:
parent
163debc8a0
commit
611a41562e
12 changed files with 167 additions and 183 deletions
43
scripts/wpass
Normal file
43
scripts/wpass
Normal file
|
@ -0,0 +1,43 @@
|
|||
_gpg-unlock
|
||||
set -xe
|
||||
|
||||
find_file() {
|
||||
fd --strip-cwd-prefix '\.gpg$' |
|
||||
sd ".gpg$" "" |
|
||||
bmenu -p "Password" $@
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
test -n "$PASSWORD_STORE_DIR" &&
|
||||
cd "$PASSWORD_STORE_DIR" ||
|
||||
cd "$HOME/.password-store"
|
||||
|
||||
entry=`find_file "$@"`
|
||||
|
||||
test -n "$entry" || exit 0
|
||||
|
||||
username=`pass show "$entry" 2>/dev/null | perl -ne 'print $2 if /^(login|user|email): (.*)/'`
|
||||
password=`pass show "$entry" 2>/dev/null | head -n 1`
|
||||
|
||||
action=`printf "Autotype\nUsername -> $username\nPassword" | bmenu -p Action`
|
||||
|
||||
case $action in
|
||||
Autotype)
|
||||
autotype
|
||||
;;
|
||||
Username*)
|
||||
printf '%s' "$username" | wl-copy;;
|
||||
Password)
|
||||
printf '%s' "$password" | wl-copy;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
autotype(){
|
||||
env wtype -s 100 "$username"
|
||||
env wtype -s 100 -k tab
|
||||
env wtype -s 100 "$password"
|
||||
}
|
||||
|
||||
main
|
Loading…
Add table
Add a link
Reference in a new issue