Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
986 B

4 years ago
4 years ago
4 years ago
4 years ago
  1. #!/bin/bash
  2. shopt -s nullglob globstar
  3. typeit=0
  4. if [[ $1 == "--type" ]]; then
  5. typeit=1
  6. shift
  7. fi
  8. prefix=${PASSWORD_STORE_DIR-~/.password-store}
  9. password_files=( "$prefix"/**/*.gpg )
  10. password_files=( "${password_files[@]#"$prefix"/}" )
  11. password_files=( "${password_files[@]%.gpg}" )
  12. folder=$(printf '%s\n' "${password_files[@]}" | cut -d"/" -f1 | sort | uniq | dmenu -l 10 -p "Folder" -i "$@")
  13. [[ -n $folder ]] || exit
  14. open_urls="$($HOME/.local/bin/exfirefoxtabs.py | awk -F/ '{print $3}' | sort | uniq )"
  15. site=$(printf '%s\n%s\n' "$open_urls" "$("${password_files[@]}" | cut -d"/" -f2 )" | dmenu -l 10 -p "Site" -i "$@")
  16. [[ -n $site ]] || exit
  17. username=$(printf '%s\n' "${password_files[@]}" | cut -d"/" -f3 | sort | uniq | dmenu -l 10 -p "Username" "$@")
  18. [[ -n $username ]] || exit
  19. pass generate -c "$folder/$site/$username"
  20. notify-send -a " Password Manager" "Generate and saved new password";
  21. pass git add .
  22. pass git commit -m "Added $folder/$site/$username"
  23. pass git push