bunteshaus.de/new.sh

39 lines
1.1 KiB
Bash
Raw Normal View History

2022-04-08 18:04:48 +02:00
#!/bin/bash
if [ ${#@} -eq 0 ]; then
echo "Titel des Artikels"
read -p ": " title
else
title="$@"
fi
2022-04-08 18:33:14 +02:00
date_long=$(date +%Y-%m-%dT%H:%M:00+0200)
2022-04-08 18:04:48 +02:00
date=$(date +%Y-%m-%d)
title_=${title// /-}
mkdir -p "content/news/${date}-${title_}"
echo "---" > "content/news/${date}-${title_}/index.de.md"
echo "title: \"${title}\"" >> "content/news/${date}-${title_}/index.de.md"
2022-04-08 18:33:14 +02:00
echo "date: ${date_long}" >> "content/news/${date}-${title_}/index.de.md"
2022-04-08 18:04:48 +02:00
echo "---" >> "content/news/${date}-${title_}/index.de.md"
2022-04-08 18:33:14 +02:00
git add "content/news/${date}-${title_}/"
2022-04-12 12:34:36 +02:00
git commit -m "New Post: ${date}-${title}"
2022-04-08 18:42:39 +02:00
2022-04-08 18:33:14 +02:00
for i in vim nano gedit kate; do
if command -v $i > /dev/null; then
editor="$i"
fi
done
2022-04-08 18:42:39 +02:00
2022-04-08 18:33:14 +02:00
echo ""
echo ""
echo "Schreibe nun mit einem einfachen Editor deinen Artikel."
2022-04-08 19:47:52 +02:00
echo ""
2022-04-08 18:33:14 +02:00
echo "'${editor} content/news/${date}-${title_}/index.de.md'"
2022-04-08 19:47:52 +02:00
echo ""
echo "'https://buha.rotce.de/misc/generator/' hilft dir!"
echo ""
2022-04-08 18:33:14 +02:00
echo "Lege vielleicht noch Bilder in den Ordner 'content/news/${date}-${title_}'"
echo ""
echo "Wenn du fertig bist, nutze './push.sh' um das hochzuladen."