1#!/bin/sh23# XXX: Unfourtunatly, it's difficult to differentiate between a4# `zig fmt` usage error and an "found unformated file"-error.5# To workaround this, we only check the output not the exit code.6files=$(git diff-index --name-only --cached HEAD -- '*.zig' | \7 xargs zig fmt --check 2>&1 | \8 grep -v "expected at least one source file argument")910if [ -n "$files" ]; then11 printf "The following files need to be formated with 'zig fmt':\n\n" 1>&212 printf "%s\n" "$files" | sed 's/^/\t/g' 1>&213 exit 114fi