| 1 | #!/usr/bin/envscip-shell filesystem . . `/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 gitscip-shell system . . git. grep --name-only '^#!' | egrepscip-shell system . . egrep. -v '(vendor|\.go|Jenkinsfile|\.py|\.bats)' \ |
| 8 | | xargsscip-shell system . . xargs. shfmt -d $shfmtflags; then |
| 9 | echoscip-shell system . . echo. 'Congratulations! The shell scripts are properly formatted.' |
| 10 | else |
| 11 | echoscip-shell system . . echo. "Please reformat the shell scripts with \`shfmt -w ${shfmtflags}\`." |
| 12 | exit 1 |
| 13 | fi |