From 34a97107375f3df8bb0562c40b6cd71618be483c Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 27 Apr 2017 06:37:39 +0200 Subject: [PATCH] temporary override of getpw for migration --- .zsh/func/{getpw => old-getpw} | 2 +- .zsh/zshrc/99-getpw-override | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) rename .zsh/func/{getpw => old-getpw} (98%) mode change 100644 => 100755 create mode 100644 .zsh/zshrc/99-getpw-override diff --git a/.zsh/func/getpw b/.zsh/func/old-getpw old mode 100644 new mode 100755 similarity index 98% rename from .zsh/func/getpw rename to .zsh/func/old-getpw index 108b4cd..4bdb401 --- a/.zsh/func/getpw +++ b/.zsh/func/old-getpw @@ -54,7 +54,7 @@ gpg --decrypt --quiet "$PWENCFILE" | \ esac done) } -[ -z "$output" ] && return 0 +[ -z "$output" ] && return 1 typeset -al results results=(${(f)output}) diff --git a/.zsh/zshrc/99-getpw-override b/.zsh/zshrc/99-getpw-override new file mode 100644 index 0000000..1673631 --- /dev/null +++ b/.zsh/zshrc/99-getpw-override @@ -0,0 +1,12 @@ +unalias getpw +getpw() { + if ! pass -c "$@"; then + if old-getpw "$@"; then + echo >&2 "Please migrate the password for $@" + genpw "$@" + echo >&2 "Old password is now in X paste buffer, new one in clipboard" + fi + fi +} +autoload -zU compdef +compdef _pass getpw -- 2.39.5