]> git.rmz.io Git - dotfiles.git/blob - bin/old/refactor_password-store.sh
zsh: update zsh-syntax-highlighting submodule
[dotfiles.git] / bin / old / refactor_password-store.sh
1 #!/bin/bash
2
3 while read p; do
4 multi="$(pass "$p")"
5 username=$(echo -e "$multi" | sed -n 's/username: //p')
6 url=$(echo -e "$multi" | sed -n -e 's/url: //p')
7 urlstrip=$(echo "$url" | sed -re "s,([^/]*//)?([^@]*@)?(www\.)?([^:/]*).*,\4,")
8 if [[ -n "$url" && -n "$username" ]]; then
9 newfile="$urlstrip/$username.gpg"
10 if [[ -f "$newfile" ]]; then
11 echo "$newfile" already exists... skipping "$p"
12 else
13 mkdir "$urlstrip"
14 git mv "$p.gpg" "$newfile"
15 fi
16 fi
17 done < list