|
4 | 4 | # |
5 | 5 | # Usage: |
6 | 6 | # ./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 |
9 | 9 | # ./runformat --expected-uncrustify-version # print ONLY the expected Uncrustify version |
10 | 10 | # |
11 | 11 | # You may also set: |
12 | 12 | # 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 |
14 | 14 | # |
15 | 15 | # Requirements: |
16 | 16 | # - All developers must use the *exact* same Uncrustify version to avoid format churn. |
17 | 17 | # - Either: |
18 | 18 | # * Have `uncrustify` in PATH, or |
19 | 19 | # * 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. |
21 | 21 | # |
22 | 22 | # Notes: |
23 | 23 | # - The local install lives under: ./.runformat-uncrustify/uncrustify-<version>-install |
@@ -99,13 +99,13 @@ print_expected_uncrustify_version_and_exit() { |
99 | 99 | # -------------------------- |
100 | 100 | DO_INSTALL=0 |
101 | 101 | PRINT_EXPECTED_UNCRUSTIFY_VERSION=0 |
102 | | -# Accept: -install, --install-dir <dir>, -h/--help |
| 102 | +# Accept: --install, --install-dir <dir>, -h/--help |
103 | 103 | while [[ $# -gt 0 ]]; do |
104 | 104 | case "$1" in |
105 | 105 | -h|--help) |
106 | 106 | print_usage_and_exit |
107 | 107 | ;; |
108 | | - -install) |
| 108 | + --install) |
109 | 109 | DO_INSTALL=1 |
110 | 110 | shift |
111 | 111 | ;; |
|
148 | 148 | # Check Uncrustify availability |
149 | 149 | if ! command -v "$UNCRUSTIFY" >/dev/null 2>&1; then |
150 | 150 | 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]" |
152 | 152 | fi |
153 | 153 |
|
154 | 154 | # Version check |
155 | 155 | DETECTED_VERSION="$("$UNCRUSTIFY" --version 2>&1 | grep -oE '[0-9]+(\.[0-9]+)*' | head -n1 || true)" |
156 | 156 | echo "Detected Uncrustify: ${DETECTED_VERSION:-unknown}" |
157 | 157 | 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." |
159 | 159 | fi |
160 | 160 |
|
161 | 161 | # Config check |
|
0 commit comments