File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,17 @@ ASTYLE_VERSION="3.4.13"
1515ASTYLE_VERSION_STR=" Artistic Style Version ${ASTYLE_VERSION} "
1616ASTYLE=" astyle"
1717
18+ if command -v astyle & > /dev/null; then
19+ ASTYLE=" astyle"
20+ elif command -v uvx & > /dev/null; then
21+ ASTYLE=" uvx --quiet ${ASTYLE} ==${ASTYLE_VERSION} "
22+ elif command -v pipx & > /dev/null; then
23+ ASTYLE=" pipx run --quiet ${ASTYLE} ==${ASTYLE_VERSION} "
24+ else
25+ echo " Neither astyle, uvx, nor pipx found in PATH"
26+ exit 1
27+ fi
28+
1829DETECTED_VERSION_STR=` $ASTYLE --version 2>&1 `
1930if [[ " $DETECTED_VERSION_STR " != ${ASTYLE_VERSION_STR} * ]]; then
2031 echo " You should use: ${ASTYLE_VERSION_STR} " ;
Original file line number Diff line number Diff line change @@ -16,7 +16,24 @@ REM ASTYLE_VERSION_STR is then constructed to match the beginning of the
1616REM version string reported by "astyle --version".
1717SET ASTYLE_VERSION = " 3.4.13"
1818SET ASTYLE_VERSION_STR = " Artistic Style Version %ASTYLE_VERSION% "
19- SET ASTYLE = " astyle"
19+
20+ REM Prefer system astyle; else try uvx; else pipx
21+ SET " ASTYLE = astyle"
22+ where astyle > nul 2 > nul
23+ IF %errorlevel% neq 0 (
24+ where uvx > nul 2 > nul
25+ IF %errorlevel% eq 0 (
26+ SET " ASTYLE = uvx --quiet astyle==%ASTYLE_VERSION% "
27+ ) ELSE (
28+ where pipx > nul 2 > nul
29+ IF %errorlevel% eq 0 (
30+ SET " ASTYLE = pipx run --quiet astyle==%ASTYLE_VERSION% "
31+ ) ELSE (
32+ ECHO ERROR: Neither astyle, uvx, nor pipx found in PATH.
33+ GOTO EXIT_ERROR
34+ )
35+ )
36+ )
2037
2138SET DETECTED_VERSION_STR = " "
2239FOR /F " tokens=*" %%i IN ('%ASTYLE% --version') DO SET DETECTED_VERSION_STR = %%i
You can’t perform that action at this time.
0 commit comments