rofi-themes/update.sh
2016-11-12 18:41:23 +01:00

58 lines
1.6 KiB
Bash
Executable file

#!/usr/bin/env bash
currentdir="$(pwd)"
rofi_themes_dir="$(dirname $0)"
cd "${rofi_themes_dir}"
git submodule update --init
# Empty file.
echo "" > README.md
# Fill it
echo "# Rofi Themes: " >> README.md
echo "Below a list of user contributed **rofi** themes." >> README.md
echo "" >> README.md
getAuthor() {
awk '/User: / { print $3 }' "${a}"
}
THEMES=(Themes/*.theme Themes/gruvbox/*.theme)
for a in ${THEMES[@]}
do
FILE=$(basename $a)
STRIPPED=$(grep -vwE "User:" "${a}")
echo "File: ${FILE}"
NAME=${FILE%.theme}
IMAGE="Screenshots/${NAME}.png"
AUTHOR=$(getAuthor)
echo "# ${FILE}" >> README.md
if [ ${AUTHOR} ];
then
echo "by ${AUTHOR}" >> README.md
fi
echo "" >> README.md
if [ ${a} -nt ${IMAGE} ]
then
./rofi/script/rofi-create-screenshot.sh "${a}" "${IMAGE}"
git add "${IMAGE}"
git add "${a}"
fi
echo "## Screenshot" >> README.md
echo "" >> README.md
echo "![Screenshot](./${IMAGE})" >> README.md
echo "" >> README.md
echo "## XResources" >> README.md
echo "" >> README.md
echo "~~~" >> README.md
echo "${STRIPPED}" >> README.md
echo "~~~" >> README.md
echo "" >> README.md
done
git add README.md
cd "${currentdir}"