esp-idf/tools/format.sh

26 lines
705 B
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
2022-09-08 02:48:30 -04:00
set -euo pipefail
if [ ! -x "$(command -v astyle_py)" ]; then
echo "astyle_py not found, please install astyle_py:"
echo " pip install -U astyle_py==VERSION"
echo "where VERSION is the same as in .pre-commit-config.yaml."
exit 1
fi
# "--astyle-version" here has to be in sync with pre-commit-config.yaml.
# The rest of the options have to be in sync with the default rules in tools/ci/astyle-rules.yml.
astyle_py --astyle-version=3.4.7 \
--style=otbs \
--attach-namespaces \
--attach-classes \
--indent=spaces=4 \
--convert-tabs \
--align-reference=name \
--keep-one-line-statements \
--pad-header \
--pad-oper \
2022-09-08 02:48:30 -04:00
--unpad-paren \
--max-continuation-indent=120 \
"$@"