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(@clack/prompts): multiselect maxItems option #151

Merged
merged 6 commits into from
Aug 29, 2023

Conversation

orochaa
Copy link
Contributor

@orochaa orochaa commented Aug 26, 2023

This PR this introduces maxItems option to multiselect prompt, using the same logic as select prompt. Now both use the same utility function limitOptions that handles this logic.

Demo

2023-08-26.13-09-17.mp4

@changeset-bot
Copy link

changeset-bot bot commented Aug 26, 2023

🦋 Changeset detected

Latest commit: 3c739f0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clack/prompts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cpreston321
Copy link
Collaborator

cpreston321 commented Aug 28, 2023

Hey @Mist3rBru! Everything looks good besides the the submitted value. The old way would show something like this @scope/a, @scope/b, @scope/c, @scope/z.

image

vs

image

@orochaa
Copy link
Contributor Author

orochaa commented Aug 28, 2023

@cpreston321 This is from main branch, I did not changed this (state) behavior.

@cpreston321
Copy link
Collaborator

cpreston321 commented Aug 28, 2023

@Mist3rBru Screenshot 1 was from main branch and screenshoot 2 was from your branch.

try it out in both: pnpm dev

@orochaa
Copy link
Contributor Author

orochaa commented Aug 28, 2023

@cpreston321 the screenshots are testing different cases, the main:line#62 is concatenating the result with \n on patch step, I can change it, but I did't it.

@cpreston321
Copy link
Collaborator

@Mist3rBru I thought it more of a symptom more then a test case. Since the maxItems was moved to a single function.

So I figured it was it was a side effect. I don't think it was intentional on your side.

@orochaa
Copy link
Contributor Author

orochaa commented Aug 28, 2023

@cpreston321 it is fine 😄. I gonna change this patch result to match multiselect result

@cpreston321 cpreston321 self-requested a review August 29, 2023 12:40
@cpreston321
Copy link
Collaborator

LGTM @Mist3rBru thanks for the PR!

🚀

@cpreston321 cpreston321 merged commit 90f8e3d into bombshell-dev:main Aug 29, 2023
@orochaa orochaa deleted the multiselect-max-items branch August 29, 2023 12:50
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