shfmt 481 B

12345678910111213
  1. #!/usr/bin/env bash
  2. set -e -o pipefail
  3. shfmtflags="-bn -ci -sr"
  4. # NOTE: `git grep '^#!'` may also pick up non-shell script files.
  5. # Add exceptional files to `egrep -v` if any false-positive is detected.
  6. if git grep --name-only '^#!' | egrep -v '(vendor|\.go|Jenkinsfile|\.py|\.bats)' \
  7. | xargs shfmt -d $shfmtflags; then
  8. echo 'Congratulations! The shell scripts are properly formatted.'
  9. else
  10. echo "Please reformat the shell scripts with \`shfmt -w ${shfmtflags}\`."
  11. exit 1
  12. fi