文件
ParlzPackageManger/build.bat
T
JGZYES 0be951c864 color: structured [PMM]:[LEVEL] output (error=red/success=green/info=gray/warn=yellow)
- Add src/out.c + src/out.h: pmm_error/pmm_success/pmm_info/pmm_warn helpers.
  Each prefixes '[PMM]:[LEVEL]' and, only when the stream is a tty, wraps it
  in an ANSI colour (red/green/gray/yellow). On redirect/pipe the text is plain.
- Replace all error/success/info/warn print statements across main.c, install.c,
  pdm.c, pmm.c, json.c with these helpers (http.c download progress bar left
  untouched so its \r overwrite stays intact).
- Windows: enable ENABLE_VIRTUAL_TERMINAL_PROCESSING on stdout/stderr so ANSI
  colours render (added alongside the existing SetConsoleOutputCP).
- Rewrite 3 install.c system() error-echo strings to colored \033[31m echoes.
- Build: add src/out.c to Makefile and build.bat.

Verified on WSL gcc: compiles clean. tty (script) shows ESC-coloured output for
INFO/ERROR/SUCCESS; non-tty shows plain '[PMM]:[LEVEL]' text with no escapes.
2026-09-04 19:23:27 +08:00

7 行
359 B
Batchfile

@echo off
rem One-shot Windows build: produces pmm.exe (needs MinGW gcc + curl in PATH)
set SRC=src\main.c src\json.c src\ini.c src\pmm.c src\http.c src\repo.c src\install.c src\sha256.c src\sha1.c src\mirrors.c src\pdm.c src\out.c
gcc -O2 -Wall -static -Wextra -std=c11 -o pmm.exe %SRC%
if errorlevel 1 (echo pmm build failed & exit /b 1)
echo built pmm.exe