From: martin f. krafft Date: Thu, 27 Apr 2017 04:37:39 +0000 (+0200) Subject: temporary override of getpw for migration X-Git-Url: https://git.madduck.net/etc/zsh.git/commitdiff_plain/34a97107375f3df8bb0562c40b6cd71618be483c?ds=sidebyside;hp=5365f4cffcb93705d61c9f8df48ed710c93b6049 temporary override of getpw for migration --- 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