configure 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/usr/bin/env bash
  2. set -e
  3. set -u
  4. set -o pipefail
  5. configopt=all
  6. __private_print_help() {
  7. echo "script usage: $(basename $0)" &&\
  8. echo " [-a] configure all" &&\
  9. echo " [-g] configure git"
  10. }
  11. while getopts 'agh' OPTION; do
  12. case "$OPTION" in
  13. a)
  14. configopt=all
  15. ;;
  16. g)
  17. configopt=git
  18. ;;
  19. h)
  20. __private_print_help
  21. exit
  22. ;;
  23. ?)
  24. __private_print_help >&2
  25. exit 1
  26. ;;
  27. esac
  28. done
  29. shift "$(($OPTIND -1))"
  30. __private_configure_git() {
  31. echo "Configuring git..."
  32. git config --global core.editor "emacs -nw"
  33. git config --global core.excludesfile '~/.gitignore_global'
  34. git config --local user.email "vaeringjar@peers.community"
  35. git config --local user.name "vaeringjar"
  36. }
  37. __private_main() {
  38. if [ "$configopt" = "all" ]; then
  39. __private_configure_git
  40. elif [ "$configopt" = "git" ]; then
  41. __private_configure_git
  42. elif [ "$configopt" = "" ]; then
  43. echo "No configopt set."
  44. __private_print_help
  45. exit 1
  46. else
  47. __private_print_help
  48. fi
  49. exit
  50. }
  51. __private_main