镜像自地址
https://github.com/JGZYES/ParlzPackageManger.git
已同步 2026-09-11 08:52:45 +08:00
fix: unknown --option is not treated as a package (install/remove)
/ previously fell through to treat the flag as a package name (looking it up in the registry / ). Now a bare leading dash is rejected as an unknown command: - install: when no package token was collected and argv[2] starts with '-', report unknown command instead of pushing the flag onto the package list. - remove: a leading '-' arg is rejected before pdm_remove. Verified: install/remove --gits report unknown command; --gitea/<known git dispatches and usage errors are unaffected.
这个提交包含在:
+9
-1
@@ -1079,6 +1079,7 @@ int main(int argc, char **argv) {
|
||||
/* pmm remove <pkg> (also used by the Windows "Uninstall" registration) */
|
||||
if (strcmp(argv[1], "remove") == 0) {
|
||||
if (argc < 3) { pmm_error("%s", pmm_tr("msg.err.usage")); return 1; }
|
||||
if (argv[2][0] == '-') { pmm_error("%s", pmm_tr_fmt("msg.err.unknown-cmd", argv[2])); return 1; }
|
||||
return pdm_remove(argv[2]) == 0 ? 0 : 1;
|
||||
}
|
||||
/* pmm self-update: install the latest 'pmm' tool package (auto os+arch) */
|
||||
@@ -1134,7 +1135,14 @@ int main(int argc, char **argv) {
|
||||
if (strncmp(a, "--version=", 10) == 0) { version = a + 10; continue; }
|
||||
if (a[0] != '-' && ni < 64) items[ni++] = a;
|
||||
}
|
||||
if (ni == 0) items[ni++] = argv[2];
|
||||
if (ni == 0) {
|
||||
/* A bare leading option (e.g. `install --gits`) is not a package; report
|
||||
* an unknown command instead of treating the flag as a name. */
|
||||
if (argv[2][0] == '-')
|
||||
pmm_error("%s", pmm_tr_fmt("msg.err.unknown-cmd", argv[2]));
|
||||
else items[ni++] = argv[2];
|
||||
if (ni == 0) return 1;
|
||||
}
|
||||
|
||||
PmmConfig cfg; MirrorSel mirror;
|
||||
load_config(&cfg);
|
||||
|
||||
在新工单中引用
屏蔽一个用户