Fix last commit to annna PATH standards and naming. - annna - Annna the nice friendly bot. HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/ DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit cde2c5e56c12b8a58bd63a772f1cfeaef8e556c4 DIR parent 4d6d4eaa7f3062b998498a2f9ee90e830805a42f HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Tue, 11 Jan 2022 21:11:54 +0100 Fix last commit to annna PATH standards and naming. Diffstat: M annna-message-common | 2 +- R imgsearch.sh -> image-search | 0 A simulate-simulator | 28 ++++++++++++++++++++++++++++ D simulate.sh | 26 -------------------------- 4 files changed, 29 insertions(+), 27 deletions(-) --- DIR diff --git a/annna-message-common b/annna-message-common @@ -861,7 +861,7 @@ case "${text}" in q="${q% simulator*}" outpath="/br/gopher/p/" { - if outfile="$(./simulate.sh "$q")" + if outfile="$(simulate-simulator "$q")" then mv "${outfile}" "${outpath}/" annna-say -s "${server}" -c "${channel}" "${user}, gopher://bitreich.org/I/p/${outfile}" DIR diff --git a/imgsearch.sh b/image-search DIR diff --git a/simulate-simulator b/simulate-simulator @@ -0,0 +1,28 @@ +#!/bin/sh + +export PATH="$HOME/bin:$PATH" + +die() { + printf '%s: error: %s\n' "${0%%*/}" "$1" + exit "${2:-1}" +} + +for q in "$@" +do + year="$(( RANDOM / 1000 + 1990 ))" + if ! img="$(image-search "$q")" + then + die "could not find a image for '$q'" + fi + out="${img%.*}-simulator.jpg" + convert -gravity NorthWest \ + -font "Helvetica-Narrow-Oblique" -pointsize 70 \ + -stroke '#000C' -strokewidth 2 -annotate +0+10 "$q" \ + -stroke none -fill white -annotate +0+10 "$q" \ + -stroke '#000C' -strokewidth 2 -annotate +0+80 "Simulator" \ + -stroke none -fill white -annotate +0+80 "Simulator" \ + -stroke '#000C' -strokewidth 2 -annotate +0+150 "$year" \ + -stroke none -fill white -annotate +0+150 "$year" \ + "$img" "$out" + printf '%s\n' "$out" +done DIR diff --git a/simulate.sh b/simulate.sh @@ -1,26 +0,0 @@ -#!/bin/sh - -die() { - printf '%s: error: %s\n' "${0%%*/}" "$1" - exit "${2:-1}" -} - -for q in "$@" -do - year="$(( RANDOM / 1000 + 1990 ))" - if ! img="$(./imgsearch.sh "$q")" - then - die "could not find a image for '$q'" - fi - out="${img%.*}-simulator.jpg" - convert -gravity NorthWest \ - -font "Helvetica-Narrow-Oblique" -pointsize 70 \ - -stroke '#000C' -strokewidth 2 -annotate +0+10 "$q" \ - -stroke none -fill white -annotate +0+10 "$q" \ - -stroke '#000C' -strokewidth 2 -annotate +0+80 "Simulator" \ - -stroke none -fill white -annotate +0+80 "Simulator" \ - -stroke '#000C' -strokewidth 2 -annotate +0+150 "$year" \ - -stroke none -fill white -annotate +0+150 "$year" \ - "$img" "$out" - printf '%s\n' "$out" -done