mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-22 12:28:03 +08:00
update fix_code_style.sh script
This commit is contained in:
+49
-19
@@ -1,20 +1,50 @@
|
||||
#!/bin/sh
|
||||
astyle \
|
||||
--style=kr \
|
||||
--indent=spaces=2 \
|
||||
--convert-tabs \
|
||||
--indent-switches \
|
||||
--indent-preprocessor \
|
||||
--pad-oper \
|
||||
--pad-header \
|
||||
--unpad-paren \
|
||||
--keep-one-line-blocks \
|
||||
--keep-one-line-statements \
|
||||
--align-pointer=type \
|
||||
--suffix=none \
|
||||
--lineend=linux \
|
||||
--add-brackets \
|
||||
$*
|
||||
#!/bin/bash
|
||||
|
||||
# options that don't seem to be supported by astyle 2.01
|
||||
# --attach-extern-c --align-reference=name --ignore-exclude-errors-x --max-code-length=120
|
||||
if ! type "astyle" > /dev/null; then
|
||||
echo "You need to install astyle to use this script!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Please provide one or multiple files as arguments!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ASTYLE_VERSION=`astyle --version 2>&1| awk '{print $4}'`
|
||||
echo "Using astyle version $ASTYLE_VERSION"
|
||||
|
||||
if [ $(bc <<< "$ASTYLE_VERSION >= 2.03") -eq 1 ]; then
|
||||
astyle --style=kr \
|
||||
--indent=spaces=2 \
|
||||
--convert-tabs \
|
||||
--indent-switches \
|
||||
--indent-preprocessor \
|
||||
--pad-oper \
|
||||
--pad-header \
|
||||
--unpad-paren \
|
||||
--keep-one-line-blocks \
|
||||
--keep-one-line-statements \
|
||||
--align-pointer=type \
|
||||
--suffix=none \
|
||||
--lineend=linux \
|
||||
--add-brackets \
|
||||
--ignore-exclude-errors-x \
|
||||
--max-code-length=100 \
|
||||
$*
|
||||
else
|
||||
astyle --style=kr \
|
||||
--indent=spaces=2 \
|
||||
--convert-tabs \
|
||||
--indent-switches \
|
||||
--indent-preprocessor \
|
||||
--pad-oper \
|
||||
--pad-header \
|
||||
--unpad-paren \
|
||||
--keep-one-line-blocks \
|
||||
--keep-one-line-statements \
|
||||
--align-pointer=type \
|
||||
--suffix=none \
|
||||
--lineend=linux \
|
||||
--add-brackets \
|
||||
$*
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user