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

Support counting of bool/flag variables #143

Closed
lunim opened this issue Aug 28, 2018 · 2 comments
Closed

Support counting of bool/flag variables #143

lunim opened this issue Aug 28, 2018 · 2 comments
Labels
enhancement help wanted We would be willing to take a well-written PR to help fix this.
Milestone

Comments

@lunim
Copy link

lunim commented Aug 28, 2018

I am looking to get a count of a specific flag. For example, I would like to support the ability to specific -v, -vv, -vvv (etc) and get a count of that.

I have tried to specify the following, but this is not supported:

[Option("-v", "Verbose", CommandOptionType.NoValue)] public bool[] Verbose { get; }

[Option("-v", "Verbose", CommandOptionType.MultipleValue)] public int Verbose { get; }

@natemcmaster natemcmaster added enhancement help wanted We would be willing to take a well-written PR to help fix this. labels Aug 28, 2018
@natemcmaster
Copy link
Owner

I'd accept a PR for this.

@natemcmaster natemcmaster added this to the 2.3.0 milestone Sep 25, 2018
@natemcmaster
Copy link
Owner

Usage:

[Option("-v", "Verbose")] public bool[] Verbose { get; }

You should be able to use Verbose.Length to see how many times the flag was specified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted We would be willing to take a well-written PR to help fix this.
Projects
None yet
Development

No branches or pull requests

2 participants