rofi-themes/update.sh

52 lines
1.5 KiB
Bash
Raw Normal View History

2015-12-10 21:13:02 +01:00
#!/usr/bin/env bash
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
2015-12-29 15:11:15 +01:00
THEMES=(Themes/*.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 [ -n ${AUTHOR} ];
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