From 7a99f648cf97246dfccb5fed273b43dd455fbe65 Mon Sep 17 00:00:00 2001 From: velvettear Date: Thu, 23 Nov 2023 14:46:39 +0100 Subject: [PATCH] added shell script --- gosplash.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 gosplash.sh diff --git a/gosplash.sh b/gosplash.sh new file mode 100755 index 0000000..8d05b40 --- /dev/null +++ b/gosplash.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +# author: Daniel Sommer +# license: MIT + +# variables overriding/setting the required environment variables +apiKey="hQ17Lw5A-3PeXA8OCZUtngRKYbDrXoTwawW6Eh1bP-w" +query="" +count="" + +# directory and file variables +pwd="$(pwd)" +dir="$(dirname $(realpath $0))" + +bin="$dir/gosplash" + +# check if the binary exists +[[ ! -f "$bin" ]] && printf "error: gosplash binary could not be found at '"$bin"'\n" && exit 1 + +# check the environment variables +[[ -z "$GOSPLASH_APIKEY" ]] && export GOSPLASH_APIKEY="$apiKey" +[[ -z "$GOSPLASH_QUERY" ]] && export GOSPLASH_QUERY="$query" +[[ -z "$GOSPLASH_COUNT" ]] && export GOSPLASH_COUNT="$count" + +echo "$GOSPLASH_APIKEY" + +# run gosplash +$bin