Skip to content

Commit 47c9d20

Browse files
committed
add --install
1 parent 4871b62 commit 47c9d20

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

runformat

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
#
55
# Usage:
66
# ./runformat # format using the configured Uncrustify
7-
# ./runformat -install # download, build, and use Uncrustify locally
8-
# ./runformat -install --install-dir /abs/path
7+
# ./runformat --install # download, build, and use Uncrustify locally
8+
# ./runformat --install --install-dir /abs/path
99
# ./runformat --expected-uncrustify-version # print ONLY the expected Uncrustify version
1010
#
1111
# You may also set:
1212
# UNCRUSTIFY=/abs/path/to/uncrustify # use a specific binary
13-
# UNCRUSTIFY_INSTALL_DIR=/abs/path # where `-install` will install
13+
# UNCRUSTIFY_INSTALL_DIR=/abs/path # where `--install` will install
1414
#
1515
# Requirements:
1616
# - All developers must use the *exact* same Uncrustify version to avoid format churn.
1717
# - Either:
1818
# * Have `uncrustify` in PATH, or
1919
# * Set env var UNCRUSTIFY=/absolute/path/to/uncrustify, or
20-
# * Run `./runformat -install` to fetch & build the pinned version locally.
20+
# * Run `./runformat --install` to fetch & build the pinned version locally.
2121
#
2222
# Notes:
2323
# - The local install lives under: ./.runformat-uncrustify/uncrustify-<version>-install
@@ -99,13 +99,13 @@ print_expected_uncrustify_version_and_exit() {
9999
# --------------------------
100100
DO_INSTALL=0
101101
PRINT_EXPECTED_UNCRUSTIFY_VERSION=0
102-
# Accept: -install, --install-dir <dir>, -h/--help
102+
# Accept: --install, --install-dir <dir>, -h/--help
103103
while [[ $# -gt 0 ]]; do
104104
case "$1" in
105105
-h|--help)
106106
print_usage_and_exit
107107
;;
108-
-install)
108+
--install)
109109
DO_INSTALL=1
110110
shift
111111
;;
@@ -148,14 +148,14 @@ fi
148148
# Check Uncrustify availability
149149
if ! command -v "$UNCRUSTIFY" >/dev/null 2>&1; then
150150
err "Uncrustify executable not found: $UNCRUSTIFY"
151-
die "Add it to PATH, set UNCRUSTIFY=/path/to/uncrustify, or run: $0 -install [--install-dir DIR]"
151+
die "Add it to PATH, set UNCRUSTIFY=/path/to/uncrustify, or run: $0 --install [--install-dir DIR]"
152152
fi
153153

154154
# Version check
155155
DETECTED_VERSION="$("$UNCRUSTIFY" --version 2>&1 | grep -oE '[0-9]+(\.[0-9]+)*' | head -n1 || true)"
156156
echo "Detected Uncrustify: ${DETECTED_VERSION:-unknown}"
157157
if [[ "$DETECTED_VERSION" != "${UNCRUSTIFY_VERSION}" ]]; then
158-
die "Expected Uncrustify ${UNCRUSTIFY_VERSION}. Re-run with -install (and optionally --install-dir) or set UNCRUSTIFY."
158+
die "Expected Uncrustify ${UNCRUSTIFY_VERSION}. Re-run with --install (and optionally --install-dir) or set UNCRUSTIFY."
159159
fi
160160

161161
# Config check

0 commit comments

Comments
 (0)