]> git.madduck.net Git - etc/zsh.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

temporary override of getpw for migration
authormartin f. krafft <madduck@madduck.net>
Thu, 27 Apr 2017 04:37:39 +0000 (06:37 +0200)
committermartin f. krafft <madduck@madduck.net>
Wed, 17 May 2017 12:35:04 +0000 (14:35 +0200)
.zsh/func/old-getpw [moved from .zsh/func/getpw with 98% similarity, mode: 0755]
.zsh/zshrc/99-getpw-override [new file with mode: 0644]

old mode 100644 (file)
new mode 100755 (executable)
similarity index 98%
rename from .zsh/func/getpw
rename to .zsh/func/old-getpw
index 108b4cd..4bdb401
@@ -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 (file)
index 0000000..1673631
--- /dev/null
@@ -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