diff options
author | cos <cos> | 2020-12-01 08:49:34 +0100 |
---|---|---|
committer | cos <cos> | 2020-12-01 11:41:29 +0100 |
commit | 7b0a1642a13077d5931469d6281ea20a98ec0ace (patch) | |
tree | bea6d9125f996332af0885741495a130c254bc71 /bin/init_rust.sh | |
parent | 2dee27ef7a77b0806c8a3142a191c19bb827d000 (diff) | |
download | adventofcode-7b0a1642a13077d5931469d6281ea20a98ec0ace.zip |
Initial addition of support scripts
Diffstat (limited to 'bin/init_rust.sh')
-rwxr-xr-x | bin/init_rust.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/bin/init_rust.sh b/bin/init_rust.sh new file mode 100755 index 0000000..38825b1 --- /dev/null +++ b/bin/init_rust.sh @@ -0,0 +1,26 @@ +#!/bin/sh -e + +YEAR=${YEAR:-$(date +%Y)} +DAY=${DAY:-$(TZ=EST date '+%d')} + +GIT_USER=$(git config --get 'user.name') +GIT_EMAIL=$(git config --get 'user.email') + +CARGO=$( sed "s/^#\( *${DAY}\)/\1/" <"${YEAR}/rust/Cargo.toml") +echo "${CARGO}" >"${YEAR}/rust/Cargo.toml" + +cd "${YEAR}/rust" +mkdir "day${DAY}" || : +cd "day${DAY}" + +cargo init --bin + +cat > 'Cargo.toml' << END_OF_TOML +[package] +name = "day${DAY}" +version = "0.1.0" +authors = ["${GIT_USER} <${GIT_EMAIL}>"] +edition = "2018" + +[dependencies] +END_OF_TOML |