cdotfis/dotfiles/.local/bin/rbw-menu

27 lines
449 B
Bash
Executable File

#!/usr/bin/env sh
set -eu
IFS='
'
rbw unlocked >/dev/null 2>&1 || rbw unlock
query=${1:-username}
chosen_item=$(
eval "rbw list | dmenu"
)
[ "$chosen_item" = "" ] && exit 1
case "$query" in
code)
rbw code "$chosen_item"
;;
*)
item="$(rbw get "$chosen_item" --raw)"
echo "$item" | jq --join-output ".data.username" | xclip -i -selection clipboard
echo "$item" | jq --join-output ".data.password" | xclip -i -selection primary
;;
esac