====== Bitwarden command line tool ======
===== Install =====
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt update && sudo apt install -y nodejs
sudo npm install -g npm@latest
sudo npm install -g @bitwarden/cli
bw --version
===== Configuration =====
# set the CLI's server to your Vaultwarden
bw config server https://vault.seanys.com
bw login securedata@seanys.com
? Master password: [hidden]
You are logged in!
export BW_SESSION="$(bw unlock --raw)"
===== Manage folders =====
List:
bw list folders --raw | jq -r '.[] | select(.id != null) | "\(.id)\t\(.name)"'
Delete all folders:
bw list folders --raw \
| jq -r '.[] | select(.id != null) | .id' \
| while IFS= read -r id; do
bw --session "$BW_SESSION" delete folder "$id"
done