docs(cli): add custom keybinding documentation (#21980)

This commit is contained in:
Tommaso Sciortino
2026-03-11 14:25:24 +00:00
committed by GitHub
parent 88638c14f7
commit 3e3d04877b
4 changed files with 153 additions and 99 deletions
+5 -3
View File
@@ -27,6 +27,7 @@ const OUTPUT_RELATIVE_PATH = ['docs', 'reference', 'keyboard-shortcuts.md'];
import { formatKeyBinding } from '../packages/cli/src/ui/key/keybindingUtils.js';
export interface KeybindingDocCommand {
command: string;
description: string;
bindings: readonly KeyBinding[];
}
@@ -81,6 +82,7 @@ export function buildDefaultDocSections(): readonly KeybindingDocSection[] {
return commandCategories.map((category) => ({
title: category.title,
commands: category.commands.map((command) => ({
command: command,
description: commandDescriptions[command],
bindings: defaultKeyBindingConfig.get(command) ?? [],
})),
@@ -94,14 +96,14 @@ export function renderDocumentation(
const rows = section.commands.map((command) => {
const formattedBindings = formatBindings(command.bindings);
const keysCell = formattedBindings.join('<br />');
return `| ${command.description} | ${keysCell} |`;
return `| \`${command.command}\` | ${command.description} | ${keysCell} |`;
});
return [
`#### ${section.title}`,
'',
'| Action | Keys |',
'| --- | --- |',
'| Command | Action | Keys |',
'| --- | --- | --- |',
...rows,
].join('\n');
});