summaryrefslogtreecommitdiff
path: root/scripts/bokftui-bw
diff options
context:
space:
mode:
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() {