Add otp support to bin/pass-get

This commit is contained in:
Henrik Lissner 2018-01-23 22:51:22 -05:00
parent 566a187f3d
commit ed8980474e
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -17,11 +17,11 @@ if [[ ! $secrets ]]; then
exit 2
fi
if [[ $field == password || -z $field ]]; then
printf "%s" "$(head -n1 <<<"$secrets")"
else
printf "%s" "$(awk -v "key=$field:" '$1 == key {print $2}' <<<"$secrets")"
fi | xsel -i -b -t 15000
case $field in
password) printf "%s" "$(head -n1 <<<"$secrets")" ;;
otp) printf "%s" "$(pass otp "$entry")" ;;
*) printf "%s" "$(awk -v "key=$field:" '$1 == key {print $2}' <<<"$secrets")" ;;
esac | xsel -i -b -t 15000
#
echo "Copied $entry:$field to clipboard for 15s"