|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
validate() {
|
|
|
|
|
utility="clang-format"
|
|
|
|
|
utility_version="$("$utility" --version 2>/dev/null)" || {
|
|
|
|
|
echo "$utility not found in path!"
|
|
|
|
@ -24,6 +25,7 @@ if ((major < required_major)) || ((minor < required_minor)) || ((patch < require
|
|
|
|
|
echo "$utility $required_major.$required_minor.$required_patch required, but is $major.$minor.$patch"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
help() {
|
|
|
|
|
echo "Usage: $0 [OPTION]..."
|
|
|
|
@ -53,6 +55,6 @@ format() {
|
|
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
|
"-h" | "--help") help ;;
|
|
|
|
|
"-d" | "--dry-run") dry_run ;;
|
|
|
|
|
"") format ;;
|
|
|
|
|
"-d" | "--dry-run") validate && dry_run ;;
|
|
|
|
|
"") validate && format ;;
|
|
|
|
|
esac
|
|
|
|
|