Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
312976f56b | |||
1b7a8d0dbd |
@ -1,6 +1,8 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
# The return code
|
||||||
|
local ERR=0
|
||||||
# Format all c files
|
# Format all c files
|
||||||
GLOB=( **/*.c )
|
local GLOB=( **/*.c )
|
||||||
# Astyle options:
|
# Astyle options:
|
||||||
# --mode=c : c formatting
|
# --mode=c : c formatting
|
||||||
# -xc : Brace attached to class names
|
# -xc : Brace attached to class names
|
||||||
@ -16,7 +18,7 @@ GLOB=( **/*.c )
|
|||||||
# -n : Don't make a backup
|
# -n : Don't make a backup
|
||||||
# -p : Pad operators
|
# -p : Pad operators
|
||||||
# -H : Pad header (space after if, for, while)
|
# -H : Pad header (space after if, for, while)
|
||||||
OPTS=( --mode=c -xc --style=stroustrup -j -s2 -xG -S -K -N -xn -xl -n -p -H )
|
local OPTS=( --mode=c -xc --style=stroustrup -j -s2 -xG -S -K -N -xn -xl -n -p -H )
|
||||||
# Process the c files by adding the comment and removing newlines
|
# Process the c files by adding the comment and removing newlines
|
||||||
perl "${0:h}/process.pl" $GLOB
|
perl "${0:h}/process.pl" $GLOB
|
||||||
# Colorize output if you can
|
# Colorize output if you can
|
||||||
@ -25,17 +27,22 @@ if which colout>/dev/null; then
|
|||||||
else
|
else
|
||||||
astyle $OPTS $GLOB|\grep -P '^(?!Unchanged)'||true
|
astyle $OPTS $GLOB|\grep -P '^(?!Unchanged)'||true
|
||||||
fi
|
fi
|
||||||
|
# Check for todos
|
||||||
|
if command -v ag >/dev/null; then
|
||||||
|
ag TODO >&2 && ERR=2
|
||||||
|
fi
|
||||||
# Now check for documentation
|
# Now check for documentation
|
||||||
# Run doxygen, redirecting stdout to dev null, and setting stderr to $OUTPUT
|
# Run doxygen, redirecting stdout to dev null, and setting stderr to $OUTPUT
|
||||||
if command -v doxygen >/dev/null; then
|
if command -v doxygen >/dev/null; then
|
||||||
OUTPUT=$((doxygen "${0:h}/Doxyfile" > /dev/null) 2>&1)
|
OUTPUT=$((doxygen "${0:h}/Doxyfile" > /dev/null) 2>&1)
|
||||||
|
#TODO: We might need this in the future, bur for now, delete html directory
|
||||||
|
rm -r html || true
|
||||||
# If there is output, something went wrong
|
# If there is output, something went wrong
|
||||||
if [ ! -z "$OUTPUT" ]; then
|
if [ ! -z "$OUTPUT" ]; then
|
||||||
printf "$OUTPUT\n" >&2
|
printf "$OUTPUT\n" >&2
|
||||||
return 2
|
ERR=3
|
||||||
fi
|
fi
|
||||||
#TODO: We might need this in the future, bur for now, delete html directory
|
|
||||||
rm -r html || true
|
|
||||||
else
|
else
|
||||||
printf "You don't have doxygen installed. Can't check documentation\n" >&2
|
printf "You don't have doxygen installed. Can't check documentation\n" >&2
|
||||||
fi
|
fi
|
||||||
|
return "$ERR"
|
||||||
|
Loading…
Reference in New Issue
Block a user