Skip to content

Commit 47c79e5

Browse files
committed
mcpplibs.cmdline 0.0.6: completion is built in
1 parent 9b04071 commit 47c79e5

4 files changed

Lines changed: 34 additions & 2 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
### Added
1111

12+
- **mcpplibs.cmdline 0.0.6.** 命令补全内建:`app.completion()` 一次调用开启,程序以自己的命令树回答(`__complete`),bash、zsh、
13+
fish、PowerShell 的适配脚本只向程序询问;选项与参数可陈述可选值、文件或目录提示与候选回调,命令可隐藏。测试成员移到 0.0.6,
14+
并检验补全与可选值的校验。CN 镜像是 mcpp-res/cmdline 的 0.0.6 release 资产(与 GitHub 归档同一字节,sha256 24716d49…)。
1215
- **mcpp.plugins 0.27.0:新成员 rules-qml(QML 应用),rules-qt 增加 `moc_json`、`moc_includes`、`i18n.extensions`、`compile_ex`(默认关闭,既有工程的指令不变)。** rules-qml 为每个 QML 模块声明 `qt_add_qml_module` 的动作链(moc --output-json、qmltyperegistrar、qmlcachegen、rcc、qsb、qmllint),把程序 import 的 Qt QML 模块放到程序旁并写 `qt.conf`;带上插件库的 `mcpp pack` 需要 mcpp 2026.11.23.1(mcpp#1011),包的下限仍是 2026.10.30.1。CN 镜像是 mcpp-res/mcpp-plugins 的 0.27.0 release 资产(与 GitHub 归档同一字节,sha256 一致)。
1316
- **compat.slint 依赖 compat.glx-runtime(Linux),声明 GLX 的能力:修复 NVIDIA 桌面上真窗口 abort。** compat.slint 依赖 libglvnd(GL 分发器),却没有依赖任何 GL 厂商的提供者;`compat.glfw`(经 compat.glx-runtime)、compat.libgbm、godot 等都依赖 `xim:graphics`(mesa、nvidia-gl-host-link、glvnd 的 glx-vendor 布线),Slint 没有。NVIDIA 的 X 服务器要求 GLX 厂商是 NVIDIA,glvnd 找不到 `libGLX_nvidia.so.0`,`glXChooseFBConfig` 返回 0 个配置,glutin 报 “argument does not name a valid config”,femtovg 没有回退,程序 abort;无头与软件渲染不受影响。现在 Linux 上 compat.slint 依赖 `compat.glx-runtime` 2026.09.11(与 compat.glfw 同写法),`runtime.capabilities` 补 `x11.display`、`opengl.glx.driver`,`dlopen_libs` 补 `libGLX.so.0`。在 NVIDIA 580.178.04、X11 的真机上,项目只加这一个依赖时 `mcpp run` 即可运行。原有的 `display`、`opengl.egl.driver` 暂时保留(没有任何包提供它们,Wayland 上的 EGL 路径没有提供者,也未验证)。
1417
- **新 lint:声明的能力必须有它依赖的包提供(`tests/check_capability_providers.lua`,警告,`--strict` 才失败)。** 索引里 14 个能力名中,当时只有 compat.slint 的 `display` 与 `opengl.egl.driver` 没有任何包提供;lint 同时报告 compat.sdl2 声明了 `x11.display` 却不依赖提供它的 compat.glx-runtime(未处理,需要在真机上确认 SDL2 的路径)。接入 `validate.yml`,测试在 `tests/test_check_capability_providers.py`。方案与证据见 `.agents/docs/2026-11-22-host-driver-link-and-display-path-plan.md`。

‎pkgs/c/cmdline.lua‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
-- 0.0.2+ ships an upstream `mcpp.toml`, but `mcpp` is a package-level field
33
-- (not per-version) in xpkg.lua, so to keep 0.0.1 installable we keep the
44
-- workaround table here. The src/**/*.cppm layout is the same across 0.0.1,
5-
-- 0.0.2, 0.0.3, 0.0.4 and 0.0.5 (0.0.3 adds src/completions*.cppm, which the glob takes in),
5+
-- 0.0.2, 0.0.3, 0.0.4, 0.0.5 and 0.0.6 (0.0.3 adds src/completions*.cppm, which the glob takes in;
6+
-- 0.0.6 replaces src/completions/ with src/complete.cppm),
67
-- so a single Form B block describes every version correctly.
78
-- When 0.0.1 is dropped, this can be replaced with `mcpp = "*/mcpp.toml"`.
89
--
@@ -55,6 +56,13 @@ package = {
5556
},
5657
sha256 = "a8fad9858ffaa6399f299f7b66c042cb0632d9139f8b917c5b35b9add1885abf",
5758
},
59+
["0.0.6"] = {
60+
url = {
61+
GLOBAL = "https://github.com/mcpplibs/cmdline/archive/refs/tags/v0.0.6.tar.gz",
62+
CN = "https://gitcode.com/mcpp-res/cmdline/releases/download/0.0.6/cmdline-0.0.6.tar.gz",
63+
},
64+
sha256 = "24716d498f29544c56bff1015ecf8e2c06a0ae40443ee0d9edaeb8f770d8bdb5",
65+
},
5866
},
5967
macosx = {
6068
["0.0.1"] = {
@@ -92,6 +100,13 @@ package = {
92100
},
93101
sha256 = "a8fad9858ffaa6399f299f7b66c042cb0632d9139f8b917c5b35b9add1885abf",
94102
},
103+
["0.0.6"] = {
104+
url = {
105+
GLOBAL = "https://github.com/mcpplibs/cmdline/archive/refs/tags/v0.0.6.tar.gz",
106+
CN = "https://gitcode.com/mcpp-res/cmdline/releases/download/0.0.6/cmdline-0.0.6.tar.gz",
107+
},
108+
sha256 = "24716d498f29544c56bff1015ecf8e2c06a0ae40443ee0d9edaeb8f770d8bdb5",
109+
},
95110
},
96111
windows = {
97112
["0.0.1"] = {
@@ -129,6 +144,13 @@ package = {
129144
},
130145
sha256 = "a8fad9858ffaa6399f299f7b66c042cb0632d9139f8b917c5b35b9add1885abf",
131146
},
147+
["0.0.6"] = {
148+
url = {
149+
GLOBAL = "https://github.com/mcpplibs/cmdline/archive/refs/tags/v0.0.6.tar.gz",
150+
CN = "https://gitcode.com/mcpp-res/cmdline/releases/download/0.0.6/cmdline-0.0.6.tar.gz",
151+
},
152+
sha256 = "24716d498f29544c56bff1015ecf8e2c06a0ae40443ee0d9edaeb8f770d8bdb5",
153+
},
132154
},
133155
},
134156

‎tests/examples/cmdline/mcpp.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ name = "cmdline-tests"
1010
version = "0.1.0"
1111

1212
[dependencies]
13-
mcpplibs.cmdline = "0.0.5"
13+
mcpplibs.cmdline = "0.0.6"

‎tests/examples/cmdline/tests/consume.cpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ int main() {
5454
&& !tree.subcommands[0].options.empty() && tree.subcommands[0].options[0].long_name == "force",
5555
"snapshot names each subcommand and its options");
5656

57+
// 0.0.6: completion answers from the tree, with the candidates an option states.
58+
auto completing = cmdline::App("tool").option(cmdline::Option("color").values({"auto", "never"})).completion();
59+
auto answer = cmdline::completions::complete(cmdline::snapshot(completing), std::vector<std::string>{"--color", "n"});
60+
check(answer.candidates.size() == 1 && answer.candidates[0].value == "never",
61+
"completion offers the values an option states");
62+
check(!completing.parse_from("tool --color pink"), "a value outside the stated set is refused");
63+
5764
if (failures == 0) std::println("cmdline: ok");
5865
return failures == 0 ? 0 : 1;
5966
}

0 commit comments

Comments
 (0)