github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/hack/validate/shfmt (about)

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