Update .zshrc

Add update_unlock_bitwarden.sh
This commit is contained in:
Florian Beisel 2024-06-07 00:56:22 +02:00
parent 8707ccc735
commit 0f8ee4fa83
2 changed files with 29 additions and 0 deletions

View File

@ -61,6 +61,8 @@ source $ZSH/oh-my-zsh.sh
# alias ohmyzsh="mate ~/.oh-my-zsh" # alias ohmyzsh="mate ~/.oh-my-zsh"
alias bw='NODE_OPTIONS="--no-deprecation" bw' alias bw='NODE_OPTIONS="--no-deprecation" bw'
alias bwu="export BW_SESSION=$(bw unlock --raw)"
export NODE_OPTIONS="--no-deprecation" export NODE_OPTIONS="--no-deprecation"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.

View File

@ -0,0 +1,27 @@
#!/bin/bash
# Function to check if Bitwarden CLI is installed
is_bw_installed() {
command -v bw >/dev/null 2>&1
}
# Function to unlock the Bitwarden vault
unlock_vault() {
echo "Unlocking Bitwarden vault..."
BW_SESSION=$(bw unlock --raw)
export BW_SESSION
if [ -n "$BW_SESSION" ]; then
echo "Vault unlocked successfully."
bw sync
else
echo "Failed to unlock vault."
fi
}
# Check if Bitwarden CLI is installed
if is_bw_installed; then
unlock_vault
else
echo "Bitwarden CLI is not installed, doing nothing."
fi