use the real cache files and cleanup
This commit is contained in:
parent
c78d3b06f9
commit
706492577a
1 changed files with 9 additions and 8 deletions
17
bwz
17
bwz
|
|
@ -16,11 +16,7 @@ if [[ ! -f "${TMP_DIR}/items" ]] || [[ ! -f "${TMP_DIR}/items" ]]; then
|
|||
BW_SESSION=$(bw unlock --raw)
|
||||
export BW_SESSION
|
||||
echo "$BW_SESSION" > "${TMP_DIR}/session"
|
||||
|
||||
#cp items.json "${TMP_DIR}/items"
|
||||
gum spin --title 'fetching items ...' -s dot bw list items > "${TMP_DIR}/items"
|
||||
|
||||
#cp folders.json "${TMP_DIR}/folders"
|
||||
gum spin --title 'fetching folder list ...' -s dot bw list folders > "${TMP_DIR}/folders"
|
||||
fi
|
||||
|
||||
|
|
@ -33,12 +29,17 @@ folders="${TMP_DIR}/folders"
|
|||
TAB=" "
|
||||
folder_sed=$(jq -r '.[] | [ "s@" , .id , "@" , .name , "@;" ] | join("")' < "$folders")
|
||||
|
||||
copy_user="jq '.[] | select(.id == \"{1}\") | .login.username' <$items | cli-copy"
|
||||
copy_pass="jq '.[] | select(.id == \"{1}\") | .login.password' <$items | cli-copy"
|
||||
copy_totp="jq '.[] | select(.id == \"{1}\") | .login.totp' <$items | sed 's/.*secret=//; s/&.*//' \
|
||||
| oathtool -b --totp - | cli-copy)"
|
||||
|
||||
jq -r '.[] | [ .id, "{{ Color \"10\" \"0\" \""+ .name +"\" }}", .folderId ] | join("'"$TAB"'")' <"$items" \
|
||||
| sed -e "$folder_sed" \
|
||||
| gum format -t template \
|
||||
| fzf --ansi -i --delimiter "$TAB" --with-nth 2,3 \
|
||||
--bind "alt-u:execute(jq '.[] | select(.id == \"{1}\") | .login.username' <items.json | cli-copy)" \
|
||||
--bind "alt-p:execute(jq '.[] | select(.id == \"{1}\") | .login.password' <items.json | cli-copy)" \
|
||||
--bind "alt-t:execute(jq '.[] | select(.id == \"{1}\") | .login.totp' <items.json | sed 's/.*secret=//; s/&.*//' | oathtool -b --totp - | cli-copy)+change-preview-label(otp copied)" \
|
||||
--preview "echo \"{1}\"; jq '.[] | select(.id == \"{1}\")' < $items | json2yaml"
|
||||
--bind "alt-u:execute($copy_user)+change-preview-label(user copied)" \
|
||||
--bind "alt-p:execute($copy_pass)+change-preview-label(pass copied)" \
|
||||
--bind "alt-t:execute($copy_totp)+change-preview-label(totp copied)" \
|
||||
--preview "echo \"{1}\"; jq '.[] | select(.id == \"{1}\")' < $items | json2yaml | bat --color=always -p -l yaml"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue