Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

### Added

- **mcpplibs.cmdline 0.0.5.** `snapshot(const App&)` 是导出的函数,与 docs/api.md 所述一致:程序由解析它所用的定义列出自身的
命令与选项(mcpp 的 `mcpp emit surface`)。测试成员移到 0.0.5,并检验这一项。
- **mtest 0.11.0(mcpplibs.mtest、.manifest、.gtest、.capi)与新包 mcpplibs.mtest.doctest。** 协议的 `step` 与 `exercise` 事件(P5.6);
用例结束时检查它启动的进程与诊断行;机器的一份预算(O11)与抖动(O12);运行记录机器的类别;`[budget]` 与 `[ledger.*]`
由门禁判定;GCC 上一个文件的首个用例与期望由 689 ms 降为 265 ms。`mcpplibs.mtest.doctest` 是 doctest 的协议适配器(1 级),
Expand Down
23 changes: 22 additions & 1 deletion pkgs/c/cmdline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- 0.0.2+ ships an upstream `mcpp.toml`, but `mcpp` is a package-level field
-- (not per-version) in xpkg.lua, so to keep 0.0.1 installable we keep the
-- workaround table here. The src/**/*.cppm layout is the same across 0.0.1,
-- 0.0.2, 0.0.3 and 0.0.4 (0.0.3 adds src/completions*.cppm, which the glob takes in),
-- 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),
-- so a single Form B block describes every version correctly.
-- When 0.0.1 is dropped, this can be replaced with `mcpp = "*/mcpp.toml"`.
--
Expand Down Expand Up @@ -48,6 +48,13 @@ package = {
},
sha256 = "8428e829bec2f74b2841b33fc2f319cdd1316bdcd7a6c5839bdc641c7e85fd1a",
},
["0.0.5"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/cmdline/archive/refs/tags/v0.0.5.tar.gz",
CN = "https://gitcode.com/mcpp-res/cmdline/releases/download/0.0.5/cmdline-0.0.5.tar.gz",
},
sha256 = "a8fad9858ffaa6399f299f7b66c042cb0632d9139f8b917c5b35b9add1885abf",
},
},
macosx = {
["0.0.1"] = {
Expand Down Expand Up @@ -78,6 +85,13 @@ package = {
},
sha256 = "8428e829bec2f74b2841b33fc2f319cdd1316bdcd7a6c5839bdc641c7e85fd1a",
},
["0.0.5"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/cmdline/archive/refs/tags/v0.0.5.tar.gz",
CN = "https://gitcode.com/mcpp-res/cmdline/releases/download/0.0.5/cmdline-0.0.5.tar.gz",
},
sha256 = "a8fad9858ffaa6399f299f7b66c042cb0632d9139f8b917c5b35b9add1885abf",
},
},
windows = {
["0.0.1"] = {
Expand Down Expand Up @@ -108,6 +122,13 @@ package = {
},
sha256 = "8428e829bec2f74b2841b33fc2f319cdd1316bdcd7a6c5839bdc641c7e85fd1a",
},
["0.0.5"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/cmdline/archive/refs/tags/v0.0.5.tar.gz",
CN = "https://gitcode.com/mcpp-res/cmdline/releases/download/0.0.5/cmdline-0.0.5.tar.gz",
},
sha256 = "a8fad9858ffaa6399f299f7b66c042cb0632d9139f8b917c5b35b9add1885abf",
},
},
},

Expand Down
2 changes: 1 addition & 1 deletion tests/examples/cmdline/mcpp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ name = "cmdline-tests"
version = "0.1.0"

[dependencies]
mcpplibs.cmdline = "0.0.3"
mcpplibs.cmdline = "0.0.5"
6 changes: 6 additions & 0 deletions tests/examples/cmdline/tests/consume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ int main() {
auto wrong = numbers.parse_from("tool --count 3px");
check(!wrong && wrong.error().is_error(), "a value that is not a number of the type is refused");

// 0.0.5: the command tree is exported; a program lists its own commands and options from it.
auto tree = cmdline::snapshot(cmdline::App("tool").subcommand(cmdline::App("add").option(cmdline::Option("force"))));
check(tree.subcommands.size() == 1 && tree.subcommands[0].name == "add"
&& !tree.subcommands[0].options.empty() && tree.subcommands[0].options[0].long_name == "force",
"snapshot names each subcommand and its options");

if (failures == 0) std::println("cmdline: ok");
return failures == 0 ? 0 : 1;
}
Loading