Update utils.

- get-otp: simplify
- lessg: move, include doas inside
This commit is contained in:
Érico Rolim 2020-09-01 22:43:35 -03:00
parent fde98dee72
commit 1b6020874f
2 changed files with 7 additions and 3 deletions

View File

@ -1,10 +1,13 @@
#!/bin/sh
file="${OTP_ACCOUNTS:-$HOME/.local/share/otp_accounts}"
json="$(cbc-file unlock "$file")"
label="$(printf %s "$json" | jq '.[].label' | fzf --cycle)"
label="$(printf %s "$json" |
jq '.[].label' |
fzf --cycle -1 ${1:+--query "$1"}
)"
secret="$(printf %s "$json" |
jq ".[] | select (.label | contains($label))" |
jq --raw-output .secret)"
jq --raw-output ".[] | select (.label | contains($label)) | .secret"
)"
token="$(oathtool --totp -b -d 6 "$secret")"
printf %s $token

View File

@ -1,4 +1,5 @@
#!/bin/execlineb -P
doas
pipeline
{ dmesg --color=always }
less -R