Files
Burn-My-Windows/scripts/clang-format.sh
2022-09-16 17:45:08 +02:00

31 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# -------------------------------------------------------------------------------------- #
# ) ( #
# ( /( ( ( ) ( ( ( ( )\ ) ( ( #
# )\()) ))\ )( ( ( )\ ) )\))( )\ ( (()/( ( )\))( ( #
# ((_)\ /((_|()\ )\ ) )\ '(()/( ((_)()((_) )\ ) ((_)))\((_)()\ )\ #
# | |(_|_))( ((_)_(_/( _((_)) )(_)) _(()((_|_)_(_/( _| |((_)(()((_|(_) #
# | '_ \ || | '_| ' \)) | ' \()| || | \ V V / | ' \)) _` / _ \ V V (_-< #
# |_.__/\_,_|_| |_||_| |_|_|_| \_, | \_/\_/|_|_||_|\__,_\___/\_/\_//__/ #
# |__/ #
# -------------------------------------------------------------------------------------- #
# SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de>
# SPDX-License-Identifier: MIT
# Exit the script when one command fails.
set -e
# Go to the repo root.
cd "$( cd "$( dirname "$0" )" && pwd )/.." || \
{ echo "ERROR: Could not find the repo root."; exit 1; }
# Execute clang format for all *.js files.
find . -type f -name '*.js' -exec sh -c '
for file do
echo "Formatting $file..."
clang-format -i "$file"
done
' sh {} +