镜像自地址
https://github.com/JGZYES/ParlzPackageManger.git
已同步 2026-09-11 08:52:45 +08:00
- 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.
23 行
460 B
Makefile
23 行
460 B
Makefile
CC ?= gcc
|
|
CFLAGS ?= -O2 -Wall -static -Wextra -std=c11
|
|
PREFIX ?= /usr/local
|
|
|
|
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
|
|
|
|
all: pmm
|
|
|
|
pmm: $(SRC) $(wildcard src/*.h)
|
|
$(CC) $(CFLAGS) -o $@ $(SRC)
|
|
|
|
install: pmm
|
|
install -m 755 pmm $(PREFIX)/bin/pmm
|
|
|
|
uninstall:
|
|
rm -f $(PREFIX)/bin/pmm
|
|
|
|
clean:
|
|
rm -f pmm pmm.exe
|
|
|
|
.PHONY: all install uninstall clean
|