1
0
Fork 0

feat: add script to initialize project structure

- create `makeday.sh` script to set up project directories
- generate `main.go` and `main.py` templates with basic structure
- add input file creation for the specified or current day
- include author information and license in script and templates

🤖
This commit is contained in:
Sebastian Mark 2024-12-30 19:47:31 +01:00
parent 46a7e459f6
commit 5e9eba97f4

55
makeday.sh Executable file
View file

@ -0,0 +1,55 @@
#! /bin/bash
# vim: ts=2:sw=2:sts=2:tw=95:ai:fo+=ro
## Author: Sebastian Mark
## CC-BY-SA (https://creativecommons.org/licenses/by-sa/4.0/deed.de)
if [[ $# -eq 0 ]]; then
YEAR=$(date +%Y)
DAY=$(date +%d)
T=${YEAR}/${DAY}
else
T=$1
fi
mkdir -p $T
touch ${T}/input
cat <<EOT >${T}/main.go
package main
import (
"fmt"
"aoc/helper"
)
func main() {
}
EOT
cat <<EOT >${T}/main.py
#!/usr/bin/env python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# Author: Sebastian Mark
# CC-BY-SA (https://creativecommons.org/licenses/by-sa/4.0/deed.de)
# pylint: disable=missing-module-docstring,missing-function-docstring,consider-using-f-string
def readinput():
with open("input", "r", encoding="utf-8") as file:
lines = file.readlines()
return lines
def main():
pass
if __name__ == "__main__":
main()
EOT
echo "initialized $T"