dotfiles

configurations and scripts
git clone https://riazj.com/git/dotfiles
Log | Files | Refs | LICENSE

pw (375B)


      1 #!/bin/sh -e
      2 
      3 PWDIR="${XDG_DATA_HOME:-$HOME/.local/share}/pw"
      4 KEYID="riaz@riazj.com"
      5 
      6 umask 0177
      7 [ -d "$PWDIR" ] || mkdir -p "$PWDIR"
      8 
      9 case "$1" in
     10   ls) ls -1 "$PWDIR" ;;
     11   rm) rm "$PWDIR/$2" ;;
     12   mv) mv "$PWDIR/$2" "$PWDIR/$3" ;;
     13   get) gpg -qd "$PWDIR/$2" ;;
     14   set) gpg -qer "$KEYID" -o "$PWDIR/$2" ;;
     15   *) echo "usage: pw <set|get|rm|mv|ls> password" >&2; exit 1 ;;
     16 esac