summaryrefslogtreecommitdiff
path: root/scripts/bokftui-bw
diff options
context:
space:
mode:
authorAnders Betts <anders.betts@gmail.com>2026-09-20 22:25:05 +0200
committerAnders Betts <anders.betts@gmail.com>2026-09-20 22:25:05 +0200
commitcc9863fa8f865fd92d9fcd4ed47e23c24a979db0 (patch)
tree069a5a90cf7e8e433489facabc95dcdbbfdabee3 /scripts/bokftui-bw
parent6ff31279d38bd3b814f19b1fb63933544139f6cf (diff)
downloadbokf-cc9863fa8f865fd92d9fcd4ed47e23c24a979db0.tar.gz
bokf-cc9863fa8f865fd92d9fcd4ed47e23c24a979db0.zip
bokftui-bw: default to the checkout's build/bokftui
Diffstat (limited to 'scripts/bokftui-bw')
-rwxr-xr-xscripts/bokftui-bw12
1 files changed, 11 insertions, 1 deletions
diff --git a/scripts/bokftui-bw b/scripts/bokftui-bw
index 7bc07fe..985714d 100755
--- a/scripts/bokftui-bw
+++ b/scripts/bokftui-bw
@@ -12,6 +12,8 @@
# BOKF_BW_FIELD custom field that holds the secret (default: login.password)
# BOKF_BW_KIND password (default) exports BOKFD_PASSWORD;
# token exports BOKFD_TOKEN
+# BOKFTUI binary to exec (default: build/bokftui in the checkout the
+# script lives in, else bokftui from PATH)
#
# Works with the official Bitwarden CLI (bw) or with rbw. With bw the session
# key is cached in ~/.cache/bokf/bw-session (mode 0600) so the master password
@@ -25,7 +27,15 @@ if [ -z "$item" ] && [ "$#" -gt 0 ]; then
fi
field="${BOKF_BW_FIELD:-}"
kind="${BOKF_BW_KIND:-password}"
-BOKFTUI="${BOKFTUI:-bokftui}"
+BOKFTUI="${BOKFTUI:-}"
+if [ -z "$BOKFTUI" ]; then
+ root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
+ if [ -x "$root/build/bokftui" ]; then
+ BOKFTUI="$root/build/bokftui"
+ else
+ BOKFTUI=bokftui
+ fi
+fi
# $1: newline-separated "id<TAB>label" rows; prints the chosen id.
choose_item() {