Skip to content

bindCLIShortcuts need a new option to disable default shortcuts #15781

@yangxin9003

Description

@yangxin9003

Description

I write a vite plugin and the plugin need implement a new custom shortcuts.

the plugin have a vite plugin hook like this:

configureServer(server) {
            devServer = server
            devServer.bindCLIShortcuts({
                print: true,
                customShortcuts: [{
                    key: 'p',
                    description: 'xxxx',
                    action(server) {
                        console.log('test')
                    }
                }]
            })
        }

When i start a dev server in a project with commod vite,the CLI shortcuts bind twice。

for example
press h + enter will print helper text twice
press o + enter will open browser twice

What is the correct way to implement my plugin?###

Suggested solution

Add a new option in bindCLIShortcuts function to disable default shortcuts.

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3-minor-bugAn edge case that only affects very specific usage (priority)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions