Repository navigation
Add rfl::ImplicitValue for options whose value may be left out - #29
Open
clockblocker wants to merge 1 commit into
Open
clockblocker wants to merge 1 commit into
clockblocker wants to merge 1 commit into
Conversation
clockblocker
force-pushed
the
wave-base-6
branch
from
November 14, 2026 13:01
048f9fb to
c7718dc
Compare
clockblocker
force-pushed
the
implicit-value
branch
from
November 14, 2026 13:01
80fb87e to
08e0b79
Compare
clockblocker
force-pushed
the
implicit-value
branch
from
November 15, 2026 08:21
08e0b79 to
de33557
Compare
clockblocker
force-pushed
the
wave-base-9
branch
2 times, most recently
from
November 16, 2026 05:18
2e02bc2 to
ebe2135
Compare
clockblocker
force-pushed
the
implicit-value
branch
from
November 16, 2026 05:18
de33557 to
8b4e10a
Compare
clockblocker
force-pushed
the
wave-base-9
branch
from
November 17, 2026 04:36
ebe2135 to
d77d479
Compare
clockblocker
force-pushed
the
implicit-value
branch
2 times, most recently
from
November 17, 2026 05:11
a7555cd to
869157b
Compare
clockblocker
force-pushed
the
wave-base-9
branch
from
November 17, 2026 05:11
d77d479 to
9956818
Compare
clockblocker
force-pushed
the
implicit-value
branch
2 times, most recently
from
November 17, 2026 07:15
3e460c0 to
fe1fc5a
Compare
rfl::ImplicitValue<T, "text"> marks a field whose command-line option may be given without a value: a bare `--help` or `-h` stands for the text (empty by default), a value only follows '=' or is attached to a short option (`-htag`), and the next token is never taken. Like rfl::Description, it has a ReflectionType, so every other reader and writer reads and writes its inner type; the schema shows the inner type's schema, as for rfl::Short, and is_default_val_v looks through it. An rfl::Rename renames the field only as the outermost wrapper. Its constructors are noexcept only if the wrapped type's are, as for rfl::DefaultVal. rfl::cli finds it through the other wrappers, applies it in grouped short options, repeated lists and abbreviations, and rfl::cli::usage shows it as `--help[=<value>]` with "Without a value: <text>.". It needs the option table that rfl::cli::read parses with: the public parse_argv and resolve_args<T> do not apply it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
clockblocker
force-pushed
the
wave-base-9
branch
from
November 17, 2026 09:45
166cf83 to
03f4447
Compare
clockblocker
force-pushed
the
implicit-value
branch
from
November 17, 2026 09:45
fe1fc5a to
0430856
Compare
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.
Summary
Adds
rfl::ImplicitValue<T, "text">for CLI options whose value may be omitted (e.g.--colorvs--color=always,--helpvs--help=topic).Example
Key details
"text"; an explicit value must follow=or attach to a short option (-htag). It never consumes the next token, even withrfl::cli::SeparateOptionValues.ReflectionType(JSON/generic/etc. read/writeTtransparently,is_emptyandDefaultVallook through it, and JSON Schema unwraps toT's schema).Short,Description,DefaultVal,std::optional,Rename,Deprecated, grouped shorts, repeated lists, andAllowAbbreviations.ImplicitValue,Positional+ImplicitValue, wrapping a struct/map, or empty""on types where""is invalid (enums,rfl::Literal, validated strings, fixed-size lists, etc.).cli.md,default_val.md, andREADME.md.Open questions:
<T, "text">(lets"text"default to"") vs<"text", T>(matchesShort/Rename/Description)?rfl::ImplicitValue(next toShort/Positional) vsrfl::cli::ImplicitValue?AI-authored. Depends on: #21, #24, #25, #26, #27, #36.