github.com/shiroyuki/docker@v1.9.0/hack/make/validate-toml (about)

     1  #!/bin/bash
     2  
     3  source "${MAKEDIR}/.validate"
     4  
     5  IFS=$'\n'
     6  files=( $(validate_diff --diff-filter=ACMR --name-only -- 'MAINTAINERS' || true) )
     7  unset IFS
     8  
     9  badFiles=()
    10  for f in "${files[@]}"; do
    11  	# we use "git show" here to validate that what's committed has valid toml syntax
    12  	if ! git show "$VALIDATE_HEAD:$f" | tomlv /proc/self/fd/0 ; then
    13  		badFiles+=( "$f" )
    14  	fi
    15  done
    16  
    17  if [ ${#badFiles[@]} -eq 0 ]; then
    18  	echo 'Congratulations!  All toml source files changed here have valid syntax.'
    19  else
    20  	{
    21  		echo "These files are not valid toml:"
    22  		for f in "${badFiles[@]}"; do
    23  			echo " - $f"
    24  		done
    25  		echo
    26  		echo 'Please reformat the above files as valid toml'
    27  		echo
    28  	} >&2
    29  	false
    30  fi