added additional bitwarden helper functions

This commit is contained in:
Morgan McMillian 2023-04-09 18:25:49 -07:00
parent 09fdce2d5e
commit 8cb85f5214
1 changed files with 24 additions and 1 deletions

25
.bashrc
View File

@ -11,7 +11,6 @@ alias tmutt='mutt -F ~/.config/mutt/thrrgilag-muttrc'
alias dmutt='mutt -F ~/.config/mutt/delta-muttrc'
alias pmutt='mutt -F ~/.muttrc-proton'
alias wttr='curl wttr.in'
alias bwunlock='export BW_SESSION=$(bw unlock --raw)'
# set my titlebars
function set_win_title(){
@ -20,3 +19,27 @@ function set_win_title(){
starship_precmd_user_func="set_win_title"
eval "$(starship init bash)"
# Bitwarden helper functions, requires bw-cli, jq, xclip or wl-clipboard
alias bwunlock='export BW_SESSION=$(bw unlock --raw)'
function bwsearch(){
bw list items --search "$1"|jq '.[] | {id, name, username: .login.username, url: .login.url}'
}
function bwp(){
case "$XDG_SESSION_TYPE" in
x11)
bw get password "$1"|xclip -selection clipboard
sleep 5
echo -n|xclip -selection clipboard
;;
wayland)
bw get password "$1"|wl-copy
sleep 5
wl-copy --clear
;;
*)
echo "I don't know what session type this is..."
echo "$XDG_SESSION_TYPE"
;;
esac
}