Create a new ShortcutsManager instance
Configuration options for the shortcuts manager
Set server url for opening in browser
This URL will be used when the user presses 'o' to open the development server in their default browser.
The server URL to open when 'o' key is pressed
Initialize keyboard shortcuts by setting up raw mode on stdin
This method enables raw mode on stdin to capture individual keypresses and sets up the event listener for handling keyboard input. Only works in TTY environments.
Show available keyboard shortcuts in the console
Displays a formatted list of all available keyboard shortcuts and their descriptions to help users understand what actions are available.
Cleanup keyboard shortcuts and restore terminal state
Disables raw mode on stdin, removes event listeners, and restores the terminal to its normal state. Should be called when shutting down the development server.
Manages keyboard shortcuts for development server interaction.
The ShortcutsManager provides a convenient way to handle keyboard inputs during development, allowing users to restart servers, clear console, open browsers, and perform other common development tasks through simple key presses.
Example