website/bin/openring-create
2020-11-07 06:16:12 +08:00

23 lines
486 B
Bash

#!/usr/bin/env bash
LIMIT=5
INPUT_TEMP="./assets/templates/openring-input.html"
OUTPUT="./layouts/partials/openring.html"
DATA="data/blogs.json"
# Checks whether it is locally compiled or not.
if [[ -a ./openring ]]; then
OPENRING="./openring/openring";
else
OPENRING="openring";
fi
for feed in $(jq ".[]" "$DATA" | shuf --head-count $LIMIT); do
OPENRING="$OPENRING -s $feed";
done
OPENRING="$OPENRING -n $LIMIT < $INPUT_TEMP > $OUTPUT"
echo "$OPENRING"
eval $OPENRING