Skip to content

Count number of occurrences for flags#11

Merged
zefir-git merged 5 commits intomainfrom
count-flags
Nov 25, 2025
Merged

Count number of occurrences for flags#11
zefir-git merged 5 commits intomainfrom
count-flags

Conversation

@zefir-git
Copy link
Contributor

@zefir-git zefir-git commented Nov 25, 2025

ParsedArgs now stores the number of times boolean options (flags) were encountered in the command line.

Example: -vvvv or -v -v -v -v will return 4 for flag("-v") as an unsigned integer.

To check whether a flag is present (i.e. > 0 occurrences), use hasFlag("-v").

Breaking Change

The old bool flag(string | Flag) method has been renamed to bool hasFlag(string | Flag).

The new method uint flag(string | Flag) is different and works as described in this PR and in the documentation.

@zefir-git zefir-git self-assigned this Nov 25, 2025
@zefir-git zefir-git added feature A new feature semver:major Incompatible/breaking changes labels Nov 25, 2025
@zefir-git zefir-git merged commit 6744c77 into main Nov 25, 2025
1 check passed
@zefir-git zefir-git deleted the count-flags branch November 25, 2025 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A new feature semver:major Incompatible/breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant