#!/bin/sh
set -eu

case "${1:-}" in
  --check)
    set -- --dry-run --Werror
    ;;
  "")
    set -- -i
    ;;
  *)
    echo "Usage: $0 [--check]" >&2
    exit 1
    ;;
esac

clang-format -style=file "$@" source/*.cc source/*.hh tests/*.cc tests/*.hh applications/*.cc applications/*.hh
