From 77f1384a6321eef06265ea5e5b11eabdc53ab720 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 1 Jan 2017 21:03:38 +0100 Subject: show,generate: support qrcodes --- src/platform/darwin.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/platform') diff --git a/src/platform/darwin.sh b/src/platform/darwin.sh index 7b028f3..86eb325 100644 --- a/src/platform/darwin.sh +++ b/src/platform/darwin.sh @@ -31,5 +31,17 @@ tmpdir() { mount -t hfs -o noatime -o nobrowse "$DARWIN_RAMDISK_DEV" "$SECURE_TMPDIR" || die "Error: could not mount filesystem on ramdisk." } +qrcode() { + if type imgcat >/dev/null 2>&1; then + echo -n "$1" | qrencode --size 10 -o - | imgcat + elif type gm >/dev/null 2>&1; then + echo -n "$1" | qrencode --size 10 -o - | gm display -title "pass: $2" -geometry +200+200 - + elif type display >/dev/null 2>&1; then + echo -n "$1" | qrencode --size 10 -o - | display -title "pass: $2" -geometry +200+200 - + else + echo -n "$1" | qrencode -t utf8 + fi +} + GETOPT="$(brew --prefix gnu-getopt 2>/dev/null || { which port &>/dev/null && echo /opt/local; } || echo /usr/local)/bin/getopt" SHRED="srm -f -z" -- cgit v1.2.3