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
rsbuild.config.ts
export default {
  dev: {
    cliShortcuts: true,
  },
};
 
rsbuild.config.ts
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.
rsbuild.config.ts
export default {
  dev: {
    cliShortcuts: {
      custom: (shortcuts) => {
        return [
          ...shortcuts,
          {
            key: 's',
            description: 'say hello',
            action: () => {
              console.log('hello world!');
            },
          },
        ];
      },
    },
  },
};
 
rsbuild.config.ts
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, the default help hint is:
  ➜ press h + enter to show shortcuts
 
rsbuild.config.ts
export default {
  dev: {
    cliShortcuts: {
      help: false,
    },
  },
};
 
- Print a custom help hint:
 
rsbuild.config.ts
export default {
  dev: {
    cliShortcuts: {
      help: 'type "h + enter" to view available commands',
    },
  },
};