shellHook.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env bash
  2. root="$(git rev-parse --show-toplevel)"
  3. dot_git="$(git rev-parse --git-common-dir)"
  4. if [[ ! -d "${dot_git}/hooks" ]]; then mkdir -p "${dot_git}/hooks"; fi
  5. # fix old bug
  6. rm -f "${dot_git}/hooks/comit-msg"
  7. rm -f "${dot_git}/hooks/commit-msg"
  8. ln -sf "${root}/misc/git-hooks/commit-msg" "${dot_git}/hooks/commit-msg"
  9. root="$(git rev-parse --show-toplevel)"
  10. dot_git="$(git rev-parse --git-common-dir)"
  11. if [[ ! -d "${dot_git}/hooks" ]]; then mkdir -p "${dot_git}/hooks"; fi
  12. # fix old bug
  13. rm -f "${dot_git}/hooks/pre-comit"
  14. rm -f "${dot_git}/hooks/pre-commit"
  15. ln -sf "${root}/misc/git-hooks/pre-commit" "${dot_git}/hooks/pre-commit"
  16. # set template
  17. git config commit.template misc/git-hooks/commit-template.txt
  18. if ! flakebox lint --silent; then
  19. >&2 echo "ℹ️ Project recommendations detected. Run 'flakebox lint' for more info."
  20. fi
  21. if [ -n "${DIRENV_IN_ENVRC:-}" ]; then
  22. # and not set DIRENV_LOG_FORMAT
  23. if [ -n "${DIRENV_LOG_FORMAT:-}" ]; then
  24. >&2 echo "💡 Set 'DIRENV_LOG_FORMAT=\"\"' in your shell environment variables for a cleaner output of direnv"
  25. fi
  26. fi
  27. >&2 echo "💡 Run 'just' for a list of available 'just ...' helper recipes"