Skip to content

Add rfl::cli::ListDelimiter to change or turn off list splitting - #30

Closed
clockblocker wants to merge 1 commit into
wave-base-9from
cli-list-delimiter
Closed

clockblocker wants to merge 1 commit into
wave-base-9from
cli-list-delimiter

Conversation

@clockblocker

@clockblocker clockblocker commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds the opt-in rfl::cli::ListDelimiter<"..."> processor to change the list-splitting separator or disable splitting (ListDelimiter<"">) so items can contain commas.

Example

struct Config { std::vector<std::string> report; };

// Custom separator:
rfl::cli::read<Config, rfl::cli::ListDelimiter<";">>({"--report=a;b", "--report=c,d"});
// -> report = {"a", "b", "c,d"}

// Disable splitting (each occurrence/arg is one item, empty kept):
rfl::cli::read<Config, rfl::cli::ListDelimiter<"">>({"--report=a,b", "--report="});
// -> report = {"a,b", ""}

// usage:
// ListDelimiter<";"> -> --report=<v1;v2;...>
// ListDelimiter<"">  -> --report=<value>

Key details

  • Default behavior (split on ,) is unchanged when omitted; ignored by non-CLI formats.
  • Delimiter is validated at compile time (empty or a single ASCII character; duplicate ListDelimiter is a static_assert).
  • Applies to all list options and list positionals; rfl::cli::usage formats list placeholders and defaults with the same delimiter (multi-item defaults are omitted under ListDelimiter<"">).
  • Docs updated in cli.md ("List delimiter").

Open question: should CLI-only settings (ListDelimiter, AllowAbbreviations, OptionsFirst, KeepEmptyItems) remain compile-time processors, or become a runtime rfl::cli::Settings struct like rfl::csv::Settings / rfl::parquet::Settings?

AI-authored. Depends on: #26, #35, #36.

@clockblocker
clockblocker changed the base branch from wave-base-6 to wave-base-9 November 14, 2026 13:01
@clockblocker
clockblocker force-pushed the cli-list-delimiter branch 2 times, most recently from 63d29a0 to 4ddaa81 Compare November 17, 2026 07:15
rfl::cli splits list values at commas, so an item cannot contain one.
ListDelimiter<";"> splits at ';' instead, and ListDelimiter<""> does not
split: each occurrence of a list option, and each positional argument of
a list, is then exactly one item, even if it is empty. The setting
applies to every list of the struct; other fields are never split. The
delimiter is a single ASCII character, which a static_assert checks.

Like rfl::cli::AllowAbbreviations it is a processor that only rfl::cli
looks at: read passes it to the Reader, which splits each occurrence
with it, and usage shows `<v1;v2;...>`, or `<value>` without splitting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clockblocker

Copy link
Copy Markdown
Owner Author

Branch is preserved on fork and showcase/all-lanes (d0f1fca1) as a reference artifact and parked in #117 (Moonshots & Possible Scope Creep).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant