21 lines
502 B
Bash
21 lines
502 B
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
|
||
|
|
shopt -s extdebug
|
||
|
|
|
||
|
|
mkdir d$1
|
||
|
|
cp src/bin/d${1}* d$1
|
||
|
|
|
||
|
|
cat <<EOF > d$1/README.md
|
||
|
|
# Advent of code 2024
|
||
|
|
|
||
|
|
Write up for day ${1}. The below snippets exclude some boilerplate
|
||
|
|
related to reading the input, and the test cases are excluded.
|
||
|
|
|
||
|
|
EOF
|
||
|
|
|
||
|
|
for file in $(ls src/bin/d${1}p*.rs); do
|
||
|
|
echo -e "### $(basename $file)" >> d${1}/README.md
|
||
|
|
echo -e '\n```rust' >> d${1}/README.md
|
||
|
|
awk '$0=="// CODE"{cnt+=1;next}cnt%2' $file >> d${1}/README.md
|
||
|
|
echo '```' >> d${1}/README.md
|
||
|
|
done
|