Repository navigation
0.0.3: value_type<T>() and value_as<T>() — numeric options checked by the parse - #10
Merged
Merged
Conversation
…the parse (0.0.3) An option declared with value_type<T>() takes a number of type T, read with std::from_chars: a value that is not wholly one (`12px`, `-1` for an unsigned, out of range) is a parse error — "option --rate takes a number, not `fast`" — instead of each program checking it, or a bad value falling back silently to a default. ParsedArgs::value_as<T>(name) reads it back (nothing when it was not given). The same check mtest's engine makes for its integer and number parameters, now in the library (cf. mcpp's and mtest's from_chars at each call site). Tests: ValueType.* (each type read back; the errors for --long and -s forms; the builder form; an unchecked value read as nothing). README: the feature and an example. Version 0.0.3.
…hain from today's index (glibc, gcc-runtime not found)
…does (0.4.30 cannot install a current mcpp)
Sunrisepeak
added a commit
to Sunrisepeak/mui
that referenced
this pull request
Nov 9, 2026
…ine everywhere; one API described (omui describe --api, check --portable); omui package/add/remove/deps/tools/config Scope: - AGENTS §5: what a library already does is depended on (mcpplibs.* first, then mcpp-index, own code last); §4: a cmdline App is one chained, tree-shaped expression. - mcpplibs.cmdline 0.0.3 released for it (mcpplibs/cmdline#10: value_type<T>(), a numeric option checked by the parse; value_as<T>(); its CI on mcpp 2026.11.8.1), in mcpp-index (#742, CN mirror); every cmdline dependency here moved to it. - SDK: RunOptions::declare/from on cmdline, omui::command_line (a program's switches beside openmui's, parsed once); takes_value() gone. - Every hand-written argv parser moved: the player entry, examples 03/08/09/10, the showcases' mains and breakout's playtest, the site (its --lang is RunOptions's; first-frame options declared, repeats and strays still refused; --option=value now accepted, its test says so), inspector, omui-mcp, omui-gen and dist-toy, gongfu-studio, hanim, xengine, omui-music, xrender, the benchmarks, the hanim consumer. Renamed where two switches shared a name: omui-fight --computer/--computer-level, --fight P1,P2 (duel.sh, README); gongfu stage --who A,B (catalog regenerated). - lint cmdline (29 rules self-tested): a command line scanned by hand is refused (tests/bench's programs included). - One API (W3): view's component_catalog() (omuiCatalog uses it), Theme::describe(), omui.agent:api api_of (builders with `spec`, natives, tokens, verbs); protocol describe {api: true} (catalog param documented, regenerated); the player entry's --types writes api.json; omui describe --api (--json, --llms FILE); omui check --portable (an omui import, a builder not the spec's, where each is). - W15: omui package (mcpp pack, --format), add/remove, deps, tools (xlings says what is installed; --install), config (omui.config.ts over the defaults); the project commands declared as chained Apps. - lang.js: tsconfig.json built with nlohmann.json; skill: read the API before writing. Sample-verified (the user's rule: sample, push, CI verifies): omui.sdk 3/3, examples hello-im 4/4, markdown-viewer 8/8, counter 5/5, markdown-stream 4/4, space 5/5, omui.cli (project_test 6/6 incl. deps/tools/config, check), omui.mcp 10/10, inspector 3 programs, omui.gen 5 programs, gongfu.studio 3/3, hanim.studio 2/2, xengine.audio 2 programs, showcases style 10, breakout 21+8+1, fighting 41+3+3+10, wall 15; built: omui.entry.player, xrender.tool, omui.bench, competitors; lint 0. Not run here: the site's suite (CI).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An option declared with
value_type<T>()takes a number of typeT(std::from_chars); a value that is not wholly one is a parse error (option --rate takes a number, not \fast`), so a program never falls back silently to a default on a typo.ParsedArgs::value_as(name)` reads it back.Why: omui's programs move their hand-written argv loops onto cmdline (its AGENTS.md: what a library already does is depended on, not written again); mcpp and mtest each parse numbers with
from_charsat the call site — this is that check, once, in the library.Option::value_type<T>()/OptBuilder::value_type<T>(): sets takes_value, a value name (NUMBER / N), the check.ParsedArgs::value_as<T>(): the value as T; nothing when absent (or, unchecked, not a number).ValueType.*), 40/40 pass locally (mcpp 2026.11.8.1).