镜像自地址
https://github.com/JGZYES/ParlzPackageManger.git
已同步 2026-09-11 05:42:44 +08:00
- pmm upgrade [--yes]: scan ~/.pmm/installed/*.info, look up each package's latest registry version for this os/arch, and upgrade with a per-package prompt (or automatically with --yes). Adds cmp_version + installed_version helpers and wires the 'upgrade' subcommand. - pmm info: also print package description (when present) and an indented versions list (or url/sha256 for legacy single-platform entries). - Output flags: --no-color (also PMM_NO_COLOR=1), -q/--quiet (only warn+error), --verbose. Added pmm_no_color + pmm_log_level globals to out.c/out.h and a consume_global_flags() pre-dispatch pass in main.c so every subcommand honors them. info/success are suppressed only in quiet mode (verbose keeps them). - help: document upgrade, --no-color, -q/--quiet, --verbose. Verified on WSL gcc: compiles clean; no-color strips ANSI on tty, -q silences info/success while keeping errors, --verbose keeps info, info lists description + versions, upgrade recognizes up-to-date packages.
33 行
1.2 KiB
C
33 行
1.2 KiB
C
/* out.h - colored/structured console output
|
|
*
|
|
* Every user-facing message goes through one of these four helpers so PMM gets
|
|
* a consistent "[PMM]:[LEVEL]" prefix and, on a real terminal, ANSI colour:
|
|
* pmm_error -> stderr, red [PMM]:[ERROR]
|
|
* pmm_success -> stdout, green [PMM]:[SUCCESS]
|
|
* pmm_info -> stdout, grey [PMM]:[INFO]
|
|
* pmm_warn -> stderr, yellow [PMM]:[WARN]
|
|
*
|
|
* Colour is emitted ONLY when the output stream is a terminal (isatty); when
|
|
* redirecting to a file/pipe the text is printed plain with no escape codes.
|
|
*/
|
|
#ifndef PMM_OUT_H
|
|
#define PMM_OUT_H
|
|
|
|
#include <stddef.h>
|
|
|
|
/* Global output flags consulted by the pmm_* helpers.
|
|
* pmm_no_color : 1 = never emit ANSI colour (even on a tty). Set by --no-color
|
|
* or PMM_NO_COLOR=1.
|
|
* pmm_log_level : 0 = normal (INFO+SUCCESS+WARN+ERROR prints).
|
|
* 1 = quiet (-q/--quiet): only WARN and ERROR print.
|
|
* 2 = verbose (--verbose): INFO/SUCCESS print plus extra debug.
|
|
*/
|
|
extern int pmm_no_color;
|
|
extern int pmm_log_level;
|
|
|
|
void pmm_error(const char *fmt, ...);
|
|
void pmm_success(const char *fmt, ...);
|
|
void pmm_info(const char *fmt, ...);
|
|
void pmm_warn(const char *fmt, ...);
|
|
|
|
#endif |