zoap

A WiP CoAP implementation for bare-metal constrained devices in Zig

git clone https://git.8pit.net/zoap.git

 1#!/bin/sh
 2
 3# XXX: Unfourtunatly, it's difficult to differentiate between a
 4# `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")
 9
10if [ -n "$files" ]; then
11	printf "The following files need to be formated with 'zig fmt':\n\n" 1>&2
12	printf "%s\n" "$files" | sed 's/^/\t/g' 1>&2
13	exit 1
14fi