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/core,@clack/prompts): improve types event emitter & global aliases #147

Merged
merged 5 commits into from
Dec 14, 2024

Conversation

cpreston321
Copy link
Collaborator

@cpreston321 cpreston321 commented Aug 24, 2023

Resolves: #125 - without changing core default functionality.

In this PR I enhance core types for event emitter while also adding setGlobalAliases. This function while be able to map global aliases for ['up', 'down', 'left', 'right', 'space', 'enter', 'cancel'] default keys. You can also map these keys as a sequence char or the actually char name. Example.

p.setGlobalAliases([
	['w', 'up'],
	['s', 'down'],
	['a', 'left'],
	['d', 'right'],
	['escape', 'cancel'],
	['\x03', 'cancel'], // Crtl+C example from default aliases.
]);

@changeset-bot
Copy link

changeset-bot bot commented Aug 24, 2023

🦋 Changeset detected

Latest commit: 4c535a1

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

This PR includes changesets to release 2 packages
Name Type
@clack/core Patch
@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 Author

@Mist3rBru can you take a look at this ?

@cpreston321 cpreston321 added the enhancement New feature or request label Aug 24, 2023
@orochaa
Copy link
Contributor

orochaa commented Aug 24, 2023

@cpreston321 great job! You nailed it.

@cpreston321 cpreston321 marked this pull request as ready for review August 24, 2023 20:48
@cpreston321 cpreston321 requested a review from natemoo-re August 24, 2023 23:52
Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

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

Sorry it took me far, far too long to review this. It looks great and I really appreciate the contribution!

Adjusting to a minor release and merging in. I am probably going to adjust the setGlobalAliases export to a more generic setEnv() function with an aliases argument before releasing, just FYI.

@natemoo-re natemoo-re merged commit 2770eda into main Dec 14, 2024
3 checks passed
@natemoo-re natemoo-re deleted the feat/improveCore branch December 14, 2024 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Request]: Support <Esc> key for canceling?
3 participants