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.

28 lines
890 B

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. site=$(printf '%s\n' "${password_files[@]}" | cut -d"/" -f2 | sort | uniq | dmenu -l 10 -p "Site" -i "$@")
  15. [[ -n $site ]] || exit
  16. username=$(printf '%s\n' "${password_files[@]}" | cut -d"/" -f3 | sort | uniq | dmenu -l 10 -p "Username" -i "$@")
  17. [[ -n $username ]] || exit
  18. pass generate "$folder/$site/$username"
  19. notify-send -a " Password Manager" "Generate and saved new password";
  20. pass git add .
  21. pass git commit -m "Added $folder/$site/$username"
  22. pass git push