Repository navigation
Accept grouped short options such as -qfcsv in rfl::cli - #798
Open
clockblocker wants to merge 1 commit into
Open
clockblocker wants to merge 1 commit into
clockblocker wants to merge 1 commit into
Conversation
rfl::cli::read now accepts several short options in one token: in `-qvf` every flag is set up to the first option that takes a value, which takes the rest of the token (`-qfcsv`) or, if nothing is left, the next token (`-qf csv`). `-f=csv` keeps meaning "csv". A flag inside a group takes no value, and an unknown letter fails with "Unknown short argument: -x (in '-qxf').". Inputs that parsed before keep their meaning. Grouping needs the option table, so the public parse_argv still reads `-abc` as the short option "abc". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clockblocker
marked this pull request as ready for review
November 25, 2026 08:45
This branch has not been deployed
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 POSIX-style grouped short options (such as
-qv,-fcsv,-qf csv) torfl::cli::read. Purely additive — no input that parses onmainchanges meaning.Example
-qvquiet=true,verbose=true-fcsv/-qfcsv/-qf csvformat="csv"(andquiet=true)-qv falsequiet=true,verbose=false-p-42/-p -42priority=-42(-42alone stays positional)-vq=falseOption '-q' does not take a value in '-vq=false'. Write '-q=false' on its own.-qxfUnknown short argument: -x (in '-qxf').Key details
rfl::Short<"1", ...>) is declared.parse_argv(argc, argv)is unchanged.cli.md("Grouped short options").Note on
=in short option groupsIn POSIX
getopt, a value-taking short option treats every character after it as part of its value (-f=csv→"=csv"). Onmain,rfl::clialready supports=as a value separator for short options (-f=csv→"csv",-o=→"",-o=-x→"-x",-v=false→false).To stay backwards-compatible with
mainand consistent between standalone and grouped forms,=remains a separator in both:#798(matchesmain)getopt-f=csv"csv""=csv"(breaking change vsmain)-qf=csvquiet=true,format="csv"quiet=true,format="=csv"-af=all=true,format=""all=true,format="="-af==xall=true,format="=x"all=true,format="==x"A literal value starting with
=can still be passed inline as-f==xor as two tokens-f =x.AI-authored.