You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
725 B
10 lines
725 B
3 years ago
|
// Hook to add keyboard shortcuts to all inquirer prompts
|
||
|
import inquirer from 'inquirer'
|
||
|
import InterruptedPrompt from 'inquirer-interrupted-prompt'
|
||
|
|
||
|
InterruptedPrompt.replaceAllDefaults(inquirer)
|
||
|
|
||
|
// Note that the above method can only detect one key per menu, apparently, and it can't tell you which one it detected in the callback.
|
||
|
// Might be worth looking into a more flexible UI library that integrates keyboard shortcuts with its menu library.
|
||
|
// Right now we are stuck with just using one key, the Escape key to go up a level in menus. Every menu must handle it or it can crash.
|
||
|
// The inquirer-interrupted-prompt documentation shows using a prompt with an array of prompt objects as args, but it didn't work for me.
|