rofi-themes/update.sh

59 lines
1.6 KiB
Bash
Raw Normal View History

2015-12-10 21:13:02 +01:00
#!/usr/bin/env bash
currentdir="$(pwd)"
rofi_themes_dir="$(dirname $0)"
cd "${rofi_themes_dir}"
2015-12-10 21:13:02 +01:00
git submodule update --init
2015-12-10 21:20:41 +01:00
# Empty file.
echo "" > README.md
# Fill it
2015-12-29 14:11:01 +01:00
echo "# Rofi Themes: " >> README.md
2015-12-28 20:29:03 +01:00
echo "Below a list of user contributed **rofi** themes." >> README.md
2015-12-29 14:11:01 +01:00
echo "" >> README.md
getAuthor() {
awk '/User: / { print $3 }' "${a}"
}
2015-12-28 20:32:08 +01:00
2016-11-12 18:41:23 +01:00
THEMES=(Themes/*.theme Themes/gruvbox/*.theme)
2015-12-28 20:32:08 +01:00
for a in ${THEMES[@]}
2015-12-10 21:13:02 +01:00
do
2015-12-11 16:45:13 +01:00
FILE=$(basename $a)
2015-12-29 14:11:01 +01:00
STRIPPED=$(grep -vwE "User:" "${a}")
2015-12-11 16:45:13 +01:00
echo "File: ${FILE}"
NAME=${FILE%.theme}
IMAGE="Screenshots/${NAME}.png"
2015-12-29 14:11:01 +01:00
AUTHOR=$(getAuthor)
echo "# ${FILE}" >> README.md
if [ ${AUTHOR} ];
2015-12-29 14:11:01 +01:00
then
echo "by ${AUTHOR}" >> README.md
fi
2015-12-28 20:23:37 +01:00
echo "" >> README.md
if [ ${a} -nt ${IMAGE} ]
then
./rofi/script/rofi-create-screenshot.sh "${a}" "${IMAGE}"
2015-12-11 09:12:11 +01:00
git add "${IMAGE}"
git add "${a}"
fi
echo "## Screenshot" >> README.md
2015-12-28 20:23:37 +01:00
echo "" >> README.md
echo "![Screenshot](./${IMAGE})" >> README.md
2015-12-28 20:23:37 +01:00
echo "" >> README.md
echo "## XResources" >> README.md
2015-12-28 20:23:37 +01:00
echo "" >> README.md
2015-12-28 20:25:22 +01:00
echo "~~~" >> README.md
2015-12-29 14:11:01 +01:00
echo "${STRIPPED}" >> README.md
2015-12-28 20:25:22 +01:00
echo "~~~" >> README.md
echo "" >> README.md
2015-12-10 21:13:02 +01:00
done
git add README.md
cd "${currentdir}"