Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for repeated flags #84

Merged
merged 6 commits into from
Dec 28, 2024

Conversation

jhilmer
Copy link
Contributor

@jhilmer jhilmer commented Dec 27, 2024

If a flag is defined with 'multiple()' - we collect the flag repeatedly. I have extended the Context with function to fetchs all occurence of a flag. E.g. string_flag_vec which return a vector of Result<String, FlagError> similar with the other flag types.

If a flag is defined with 'mutiple()' - we collect the flag repeatly.
I have extened the `Context` with functioin to fetch all occurence
of a flag. E.g. `string_flag_vec` which return a Vector of
`Result<String, FlagError>` similar with the other flag types.
@jhilmer jhilmer marked this pull request as draft December 27, 2024 22:38
@jhilmer jhilmer marked this pull request as ready for review December 27, 2024 22:45
@ksk001100
Copy link
Owner

@jhilmer
Thanks PR. Please add examples to the ./examples directory or make changes to existing examples.

'FlagError::NotFound', 'Vec<FlagError::NotFound>' is returned when
e.g 'string_flag' and 'string_flag_vec' are callled on a flag there
is not given on the command line.
let app = App::new(name)
.author(env!("CARGO_PKG_AUTHORS"))
.description(env!("CARGO_PKG_DESCRIPTION"))
.usage("single_app [args]")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.usage("single_app [args]")
.usage("multipla_flags [args]")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@ksk001100
Copy link
Owner

@jhilmer
LGTM 👍

@ksk001100 ksk001100 merged commit 962bafa into ksk001100:master Dec 28, 2024
6 checks passed
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.

2 participants