From 5e9eba97f495caeb5545769f7ed198890f7c1b55 Mon Sep 17 00:00:00 2001 From: Sebastian Mark Date: Mon, 30 Dec 2024 19:47:31 +0100 Subject: [PATCH] feat: add script to initialize project structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 🤖 --- makeday.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 makeday.sh diff --git a/makeday.sh b/makeday.sh new file mode 100755 index 0000000..88f8801 --- /dev/null +++ b/makeday.sh @@ -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 <${T}/main.go +package main + +import ( + "fmt" + + "aoc/helper" +) + +func main() { +} +EOT + +cat <${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"