diff options
author | EuAndreh <eu@euandre.org> | 2022-05-12 12:01:54 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2022-05-12 12:01:54 -0300 |
commit | 90eaebabcaaea74237f34cf05709625345f276cc (patch) | |
tree | 349e7609d20ecfb6567652a7e28595cec9647eb0 /bin/qr | |
parent | .usr/etc/i3/config: WIP setup extra bindings (diff) | |
download | dotfiles-90eaebabcaaea74237f34cf05709625345f276cc.tar.gz dotfiles-90eaebabcaaea74237f34cf05709625345f276cc.tar.xz |
Move Git repository into ~/.usr/.git/
Diffstat (limited to 'bin/qr')
-rwxr-xr-x | bin/qr | 58 |
1 files changed, 58 insertions, 0 deletions
@@ -0,0 +1,58 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + qr [-s PIXEL_SIZE] + qr -h + EOF +} + +help() { + cat <<-'EOF' + + Options: + -s PIXEL_SIZE size of the pixel (default 10) + -h, --help show this help message + + Read data from STDIN and present a QR image with said data. + EOF +} + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +PIXEL_SIZE=10 +while getopts 's:h' flag; do + case "$flag" in + s) + PIXEL_SIZE="$OPTARG" + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + + +cat | qrencode -s "$PIXEL_SIZE" -o- | feh - |