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

feat: MultiCount Interface #236

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

wegreenall
Copy link

Adds a MultiCount interface. This extends the MultiSelect to allow for (integer) numerical counts. Rather than doing anything complicated, the count is incremented/decremented with the right and left arrows, and incremented/decremented by ten using shift and right, left arrow respectively. I stuck close to the MultiSelect paradigm to minimise the difference from old code in large commits for new features, to make it easier to compare.

If accepted I will add an appropriate README paragraph (it felt rather brash otherwise).

@mikaelmello
Copy link
Owner

Hey! This looks pretty great impl-wise, I'm interested in hearing more about the use-cases for this prompt type.

Was there something specific you needed that made you create this PR?

inquire/src/prompts/multicount/mod.rs Outdated Show resolved Hide resolved
inquire/src/prompts/multicount/mod.rs Outdated Show resolved Hide resolved
@wegreenall
Copy link
Author

Hi! Thanks for getting back to me.

Yes, I had a situation where single units (As in MultiSelect) were not enough (specifically, billable hours in different categories).
I originally wanted to have a way to type in the number but I think that perhaps what I have done here is a good middle ground between your other prompt forms and exactly doing what I had envisioned.

I'll get on with the conversion to a struct and get back to you.

@wegreenall
Copy link
Author

One question:
I note that in multiselect you pull the checkbox off the render_config struct (you use it in MultiSelectBackend). I did not see an simple way, Other than adding a field to said struct, to store the equivalent "countbox". I therefore define it directly inside
render_options on impl MultiCountBackend - see backend.rs line 492. However I don't think this is the right way to do it, but couldn't tell the best way that fits in with the rest of the code. What do you suggest? I appreciate there is a lot of stuff to look through.

@wegreenall
Copy link
Author

Would you be interested in this feature being included in repository? If so, is there anything else you need from me?

@mikaelmello
Copy link
Owner

Hey @wegreenall, I think this would be a nice addition yes, just haven't had the proper time to go through the PR yet

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