2023-11-23 14:48:17 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# author: Daniel Sommer <daniel.sommer@velvettear.de>
|
|
|
|
# license: MIT
|
|
|
|
|
|
|
|
# variables overriding/setting the required environment variables
|
|
|
|
apiKey=""
|
|
|
|
query=""
|
|
|
|
count=""
|
|
|
|
|
|
|
|
# directory and file variables
|
|
|
|
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
|
2023-11-23 14:52:11 +01:00
|
|
|
$bin "$1"
|