commit d2d458931d1377aa38d65631f02adca75e841f09 parent 9a0e379625bd4f1f00c582547236ffaf220184f9 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Sun, 31 May 2020 20:29:03 +0200 Change from meme2 to meme format Diffstat:
A | .local/bin/memeadd | | | 27 | +++++++++++++++++++++++++++ |
1 file changed, 27 insertions(+), 0 deletions(-)
diff --git a/.local/bin/memeadd b/.local/bin/memeadd @@ -0,0 +1,27 @@ +#!/bin/sh +set -e + +out="${HOME}/tmp/meMEmeME.meme" + +if [ "$1" = "-h" ]; then + printf 'usage: %s <file>\n' "${0##*/}" >&2 + printf 'usage: echo "$url" | %s\n' "${0##*/}" >&2 + exit 1 +fi + +if [ ! -e "$out" ]; then + printf 'meme\n' > "$out" +fi + +if [ "$#" -lt 1 ]; then + urls="$(cat)" +else + urls="$@" +fi + +for f in "$urls"; do + n="$(basename "$f")" + tag="#${n%.*}" + url="$(upload -o -p "$f")" + printf '%s %s %s\n' "$tag" "$url" >> "$out" +done