summaryrefslogtreecommitdiff
path: root/scripts/bokftui-bw
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/bokftui-bw')
-rwxr-xr-xscripts/bokftui-bw6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/bokftui-bw b/scripts/bokftui-bw
index 7742909..7bc07fe 100755
--- a/scripts/bokftui-bw
+++ b/scripts/bokftui-bw
@@ -105,6 +105,8 @@ elif command -v bw >/dev/null 2>&1; then
secret=$(printf '%s' "$items" | jq -r --arg id "$id" \
'.[] | select(.id == $id) | .login.password')
fi
+ item_user=$(printf '%s' "$items" | jq -r --arg id "$id" \
+ '.[] | select(.id == $id) | (.login.username // "")')
else
echo "bokftui-bw: install rbw or the Bitwarden CLI (bw)" >&2
exit 1
@@ -123,6 +125,10 @@ case "$kind" in
password)
BOKFD_PASSWORD="$secret"
export BOKFD_PASSWORD
+ if [ -n "${item_user:-}" ] && [ -z "${BOKFD_USER:-}" ]; then
+ BOKFD_USER="$item_user"
+ export BOKFD_USER
+ fi
;;
*)
echo "bokftui-bw: BOKF_BW_KIND must be password or token" >&2