From 93e0e434a54ae616a8a4649b3ae8bdc54e34b556 Mon Sep 17 00:00:00 2001 From: Adam Hovorka Date: Tue, 16 Jun 2020 17:37:29 -0600 Subject: Upgrade qr into a script that encodes and decodes --- base/qr | 12 ++++++++++++ base/zsh/aliases.zsh | 1 - 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 base/qr (limited to 'base') diff --git a/base/qr b/base/qr new file mode 100755 index 0000000..2de2dc9 --- /dev/null +++ b/base/qr @@ -0,0 +1,12 @@ +#!/bin/bash +if [[ -f "$1" ]]; then + if file -bi "$1" | grep "^image/" &>/dev/null; then + OUTPUT="$(zbarimg -q "$1" | grep "^QR-Code:")" + if [[ $? -eq 0 ]]; then + echo "$OUTPUT" | tail -c+9 + exit + fi + fi +fi + +qrencode -t UTF8 $@ diff --git a/base/zsh/aliases.zsh b/base/zsh/aliases.zsh index ccca0b2..28e908f 100644 --- a/base/zsh/aliases.zsh +++ b/base/zsh/aliases.zsh @@ -10,7 +10,6 @@ alias sudoe="sudo -E" alias svim="sudo -E vim" alias svimdiff="sudo -E vimdiff" -alias qr="qrencode -t UTF8" alias duhs="du -sh * | sort -rh" # Taken from the tmux plugin -- cgit v1.2.3-70-g09d2