diff options
author | Adam Hovorka <[email protected]> | 2020-06-16 17:37:29 -0600 |
---|---|---|
committer | Adam Hovorka <[email protected]> | 2020-06-16 17:37:29 -0600 |
commit | 93e0e434a54ae616a8a4649b3ae8bdc54e34b556 (patch) | |
tree | 74822cd8c059211f0e3adaa7910c74d2cfe45d5a | |
parent | 20bbb154467e63ce6fbae48c13fac9d3fba95587 (diff) |
Upgrade qr into a script that encodes and decodes
-rw-r--r-- | base.yaml | 1 | ||||
-rwxr-xr-x | base/qr | 12 | ||||
-rw-r--r-- | base/zsh/aliases.zsh | 1 |
3 files changed, 13 insertions, 1 deletions
@@ -17,6 +17,7 @@ ~/.bin/pr-passive: base/pr-passive ~/.bin/pr-weasel: base/pr-weasel ~/.bin/proofread: base/proofread + ~/.bin/qr: base/qr ~/.bin/tldr: base/tldr ~/.capsesc: base/capsesc ~/.curlrc: base/curlrc @@ -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 |