clack
clack copied to clipboard
[Request]: Support <Esc> key for canceling?
Is your feature request related to a problem? Please describe.
Many CLIs (anecdotally, all the ones I use) support using <Esc>
to exit, and as such, it's become muscle memory for me. However, only <C-c>
is built in as a way to cancel, so I'm currently resorting to patch-package
to add it in.
Figured I'd at least ask before I continued w/ patching.
Describe the solution you'd like
Ideally, just adding <Esc>
alongside <C-c>
:
}
- if (char === '\x03') {
+ if (char === '\x03' || key.name === 'escape') {
this.state = 'cancel';
}
https://github.com/natemoo-re/clack/blob/593f93d06c1a53c8424e9aaf0c1c63fbf6975527/packages/core/src/prompts/prompt.ts#L186-L188
Describe alternatives you've considered
N/A