scripts

Scripts for general automations
git clone git://git.laack.co/scripts.git
Log | Files | Refs

pass.sh (601B)


      1 #!/bin/bash
      2 # for some reason this stupid
      3 # line fixed the script.
      4 source ~/.bashrc
      5 
      6 shopt -s nullglob globstar
      7 
      8 typeit=0
      9 if [[ $1 == "--type" ]]; then
     10 	typeit=1
     11 	shift
     12 fi
     13 
     14 
     15 prefix='/home/andrew/gitRepos/passwords'
     16 password_files=( "$prefix"/**/*.gpg )
     17 password_files=( "${password_files[@]#"$prefix"/}" )
     18 password_files=( "${password_files[@]%.gpg}" )
     19 
     20 
     21 prompt="account:"
     22 
     23 dmenu_cmd="dmenu -p \"$prompt\""
     24 password=$(printf '%s\n' "${password_files[@]}" | eval "$dmenu_cmd")
     25 
     26 # Handle otp or passwords
     27 if [[ "$password" == *totp* ]]; then
     28   pass otp -c "$password"
     29 else
     30   pass show -c "$password"
     31 fi