shellHook.sh
1 #!/usr/bin/env bash 2 yesterday=$(date -d "yesterday" +%s) 3 motd_ts_path=".config/flakebox/tmp/motd" 4 5 if [ ! -e "$motd_ts_path" ] || [ "$motd_ts_path" -ot "$yesterday" ]; then 6 mkdir -p "$(dirname "$motd_ts_path")" 7 touch "$motd_ts_path" 8 >&2 echo "đ§ In an enfort to improve documentation, we now require all structs and" 9 >&2 echo "đ§ and public methods to be documented with a docstring." 10 >&2 echo "đ§ See https://github.com/fedimint/fedimint/issues/3807" 11 12 fi 13 14 root="$(git rev-parse --show-toplevel)" 15 dot_git="$(git rev-parse --git-common-dir)" 16 if [[ ! -d "${dot_git}/hooks" ]]; then mkdir -p "${dot_git}/hooks"; fi 17 # fix old bug 18 rm -f "${dot_git}/hooks/comit-msg" 19 rm -f "${dot_git}/hooks/commit-msg" 20 ln -sf "${root}/misc/git-hooks/commit-msg" "${dot_git}/hooks/commit-msg" 21 22 root="$(git rev-parse --show-toplevel)" 23 dot_git="$(git rev-parse --git-common-dir)" 24 if [[ ! -d "${dot_git}/hooks" ]]; then mkdir -p "${dot_git}/hooks"; fi 25 # fix old bug 26 rm -f "${dot_git}/hooks/pre-comit" 27 rm -f "${dot_git}/hooks/pre-commit" 28 ln -sf "${root}/misc/git-hooks/pre-commit" "${dot_git}/hooks/pre-commit" 29 30 # set template 31 git config commit.template misc/git-hooks/commit-template.txt 32 33 if ! flakebox lint --silent; then 34 >&2 echo "âšī¸ Project recommendations detected. Run 'flakebox lint' for more info." 35 fi 36 37 if [ -n "${DIRENV_IN_ENVRC:-}" ]; then 38 # and not set DIRENV_LOG_FORMAT 39 if [ -n "${DIRENV_LOG_FORMAT:-}" ]; then 40 >&2 echo "đĄ Set 'DIRENV_LOG_FORMAT=\"\"' in your shell environment variables for a cleaner output of direnv" 41 fi 42 fi 43 44 >&2 echo "đĄ Run 'just' for a list of available 'just ...' helper recipes"