mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-10-31 09:20:21 +00:00
6e67f38408
run with ./contrib/format.sh verify exits with 0 if we are good, exits non-zero if we are not formatted right
25 lines
929 B
Bash
Executable File
25 lines
929 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
CLANG_FORMAT_DESIRED_VERSION=11
|
|
|
|
binary=$(which clang-format-$CLANG_FORMAT_DESIRED_VERSION 2>/dev/null)
|
|
if [ $? -ne 0 ]; then
|
|
binary=$(which clang-format 2>/dev/null)
|
|
if [ $? -ne 0 ]; then
|
|
echo "Please install clang-format version $CLANG_FORMAT_DESIRED_VERSION and re-run this script."
|
|
exit 1
|
|
fi
|
|
version=$(clang-format --version)
|
|
if [[ ! $version == *"clang-format version $CLANG_FORMAT_DESIRED_VERSION"* ]]; then
|
|
echo "Please install clang-format version $CLANG_FORMAT_DESIRED_VERSION and re-run this script."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
cd "$(dirname $0)/../"
|
|
if [ "$1" = "verify" ] ; then
|
|
exit $($binary --output-replacements-xml $(find jni daemon llarp include pybind | grep -E '\.[hc](pp)?$' | grep -v '\#') | grep '</replacement>' | wc -l)
|
|
else
|
|
$binary -i $(find jni daemon llarp include pybind | grep -E '\.[hc](pp)?$' | grep -v '\#') &> /dev/null
|
|
fi
|