From: Dmitry Fedotov Date: Sat, 14 Dec 2024 19:38:57 +0000 (+0300) Subject: Add functions for password stores. X-Git-Url: https://git.dmfe.net/?a=commitdiff_plain;h=72559573c4d2190bfb2034bd039b795756cf2a25;p=dotfiles Add functions for password stores. --- diff --git a/shell/aliases/00-aliases b/shell/aliases/00-aliases index 03da67b..e532ece 100644 --- a/shell/aliases/00-aliases +++ b/shell/aliases/00-aliases @@ -28,3 +28,7 @@ alias arangos="sudo /etc/init.d/arangodb stop" # docker alias d="docker" alias dc="docker-compose" + +# pass +alias passdmfe="PASSWORD_STORE_DIR=~/.password-store pass" +alias passivfe="PASSWORD_STORE_DIR=~/pwd-stores/vania-password-store pass" diff --git a/shell/bash_completion b/shell/bash_completion new file mode 100644 index 0000000..e2b18f5 --- /dev/null +++ b/shell/bash_completion @@ -0,0 +1,11 @@ +source /usr/share/bash-completion/completions/pass + +_passdmfe(){ + PASSWORD_STORE_DIR=~/.password-store/ _pass +} +complete -o filenames -o nospace -F _passdmfe passdmfe + +_passivfe(){ + PASSWORD_STORE_DIR=~/pwd-stores/vania-password-store/ _pass +} +complete -o filenames -o nospace -F _passivfe passivfe diff --git a/shell/functions/00-functions b/shell/functions/00-functions index 8a63405..fee8bb1 100644 --- a/shell/functions/00-functions +++ b/shell/functions/00-functions @@ -23,3 +23,12 @@ function passf() { pass find $1 } +function pass_dmfe() { + local choice=$(find $HOME/.password-store -type f -name '*.gpg' -printf '%P\n' | sed 's/\.gpg//' | fzf) + [[ -n "$choice" ]] && passdmfe $choice | xclip -i -sel p -f | xclip -i -sel c +} + +function pass_ivfe() { + local choice=$(find $HOME/pwd-stores/vania-password-store -type f -name '*.gpg' -printf '%P\n' | sed 's/\.gpg//' | fzf) + [[ -n "$choice" ]] && passivfe $choice | xclip -i -sel p -f | xclip -i -sel c +}