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:

wrap editor in script
authormartin f. krafft <madduck@madduck.net>
Thu, 28 Nov 2019 20:35:15 +0000 (09:35 +1300)
committermartin f. krafft <madduck@madduck.net>
Thu, 28 Nov 2019 20:35:15 +0000 (09:35 +1300)
.bin/genpw-editor [new file with mode: 0755]
.gitignore.d/pass
.zsh/aliases/genpw

diff --git a/.bin/genpw-editor b/.bin/genpw-editor
new file mode 100755 (executable)
index 0000000..108f1b6
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+set -eu
+
+if command -v diceware >/dev/null; then
+  PW_GENERATOR='diceware -s2'
+
+elif command -v pwgen >/dev/null; then
+  PW_GENERATOR='pwgen -y 20 1'
+
+else
+  PW_GENERATOR='dd if=/dev/random bs=256 count=1 | base64'
+
+fi
+
+exec vim -c 'set noshelltemp' -c "0read! $PW_GENERATOR" -c 2d -n
index 8b3844c1efa5d2857a6167cee2290d6abbf5611c..61a21a140e08853ebe8190285850e0c3fe80f197 100644 (file)
@@ -1,4 +1,5 @@
 *
+!/.bin/genpw-editor
 !/.gitignore.d/pass
 !/.zsh/aliases/genpw
 !/.zsh/aliases/getpw
index 7b9f99777454ce7252a53ca02d91b09b3308721b..c49760298902e3178f600757d311dc623b60f3bb 100644 (file)
@@ -1 +1 @@
-() { EDITOR="vim -c 'set noshelltemp' -c '0read! diceware -s ${2:-1}' -c 2d -n" pass edit "$1"; }
+() { EDITOR="genpw-editor $2" pass edit "$1"; }