Skip to content

Conversation

@zefir-git
Copy link
Contributor

Flags (boolean options) like -a -b -c can be grouped like -abc (in any order). Only works for flags/booleans and only for short options.

Example:

new Program("cmd")
    .option("-f, --foo", "foo")
    .option("-b, --bar", "boo")
    .option("-B, --baz", "foo")
    //

The flags can be set to true like so:

cmd -fbB
# equivalent to:
cmd -f -b -B

When reading the parsed flags, they are still read separately:

auto foo = args.flag("-f");
auto bar = args.flag("-b");
auto baz = args.flag("-B");

@zefir-git zefir-git self-assigned this Nov 25, 2025
@zefir-git zefir-git added feature A new feature semver:minor New (backward compatible) functionality labels Nov 25, 2025
@zefir-git zefir-git merged commit 9430697 into main Nov 25, 2025
1 check passed
@zefir-git zefir-git deleted the group-flags branch November 25, 2025 12:46
zefir-git added a commit that referenced this pull request Nov 25, 2025
The feature checks for flags grouping like `-abc` but falsely interprets
sequences like `-a=value` as a group of flags.
zefir-git added a commit that referenced this pull request Nov 25, 2025
The feature checks for flags grouping like `-abc` but falsely interprets
sequences like `-a=value` as a group of flags.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A new feature semver:minor New (backward compatible) functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants