From 8f7481ae57df93bf3e01290f82159353257b262e Mon Sep 17 00:00:00 2001 From: CJ Virtucio Date: Sat, 26 Mar 2022 14:47:57 -0400 Subject: [PATCH] moved FORCE flag logic to outside bw_login --- bwsh/bin/bw_session.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bwsh/bin/bw_session.sh b/bwsh/bin/bw_session.sh index 1fa24fa..4ed19a4 100755 --- a/bwsh/bin/bw_session.sh +++ b/bwsh/bin/bw_session.sh @@ -54,11 +54,6 @@ function bw_creds { function bw_login { local session_file="${HOME}/.secrets/bitwarden/session" - if [[ -v FORCE ]]; then - rm -f "${session_file}" - bw logout - fi - if bw login --check "$(get_username)" &>/dev/null; then log "already logged in" if [[ -f "${session_file}" ]]; then @@ -106,6 +101,12 @@ function main { bw_login } +if [[ -v FORCE ]]; then + unset BW_SESSION + rm -f "${HOME}/.secrets/bitwarden/session" + bw logout +fi + if (return 0 &>/dev/null); then if [[ -v BW_SESSION ]]; then log "already logged in"