代码拉取完成,页面将自动刷新
#!/bin/bash -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$DIR"
FMT_COMMAND=clang-format-7
$FMT_COMMAND -version
paths="apps components test"
for x in $paths; do
find $x -name *.h -o -name *.cpp | xargs $FMT_COMMAND -i -style=file
done
if [ ! -z "$TRAVIS" ]; then
DIFF_FILE=/tmp/fa_format_diff.patch
git diff > $DIFF_FILE
if [ -s $DIFF_FILE ]; then
DIFF_URL=$(cat "$DIFF_FILE" | nc termbin.com 9999 | tr -d '\0')
echo -e "\e[31m" # red
echo "Autoformat needed, to apply the formatting changes locally, run:"
echo "curl $DIFF_URL > $DIFF_FILE && git apply $DIFF_FILE"
echo -e "\e[0m" # end red
exit 1
fi
fi
exit 0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。