Initial commit

This commit is contained in:
2023-12-05 11:52:53 +01:00
commit 8fcee096b6
34 changed files with 4217 additions and 0 deletions

39
scripts/mkday Executable file
View File

@@ -0,0 +1,39 @@
#!/bin/bash
while getopts y:l:d: flag
do
case "${flag}" in
y) year=${OPTARG};;
l) language=${OPTARG};;
d) day=${OPTARG};;
esac
done
if [[ ! $year || ! $language || ! $day ]]
then
echo "Invalid usage! Required flags are -y, -l and -d";
echo "Bye...";
exit 1;
fi
case $language in
"ts") lang="typescript";;
*) lang="unknown";;
esac
cd $year
mkdir -p $lang/day$day
cp ../templates/$lang/* ./$lang/day$day
cd ./$lang/day$day
for f in d*.txt
do
if [[ "$f" =~ ^(d)XX(p[0-9]\.)txt$ ]]; then
mv "$f" "${BASH_REMATCH[1]}${day}${BASH_REMATCH[2]}ts"
fi
done
mv "index.txt" "index.ts"