#!/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