dev.cliShortcuts
type CliShortcuts =
| boolean
| {
help?: boolean;
custom?: (shortcuts?: CliShortcut[]) => CliShortcut[];
};
- Default:
true
when using Rsbuild CLI, false
otherwise.
- Version:
>= 1.0.11
Whether to enable CLI shortcuts.
All Shortcuts
Press h + Enter
to show all shortcuts:
Shortcuts:
c + enter clear console
o + enter open in browser
q + enter quit process
r + enter restart server
u + enter show urls
Example
export default {
dev: {
cliShortcuts: true,
},
};
export default {
dev: {
cliShortcuts: false,
},
};
Custom Shortcuts
custom
option can be used to custom shortcuts, the value is a function that receives the default shortcuts array and returns a new shortcuts array.
export default {
dev: {
cliShortcuts: {
custom: (shortcuts) => {
return [
...shortcuts,
{
key: 's',
description: 'say hello',
action: () => {
console.log('hello world!');
},
},
];
},
},
},
};
export default {
dev: {
cliShortcuts: {
custom: (shortcuts) => {
return shortcuts.filter((shortcut) => shortcut.key !== 'o');
},
},
},
};
Print Help
help
option can be used to control whether to print the help hint when the server is started:
➜ press h + enter to show shortcuts
export default {
dev: {
cliShortcuts: {
help: false,
},
},
};