From ed8980474ebe43507ace52cb88d23f95358774aa Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 23 Jan 2018 22:51:22 -0500 Subject: [PATCH] Add otp support to bin/pass-get --- bin/pass-get | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/pass-get b/bin/pass-get index 2b2c8175..e7b1482f 100755 --- a/bin/pass-get +++ b/bin/pass-get @@ -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"