2020-11-05 18:58:23 +02:00
|
|
|
import markdownUtils, { MarkdownTableHeader, MarkdownTableRow } from '../../markdownUtils';
|
2020-10-18 22:52:10 +02:00
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
export default function commandsToMarkdownTable(): string {
|
|
|
|
const headers: MarkdownTableHeader[] = [
|
2020-10-18 22:52:10 +02:00
|
|
|
{
|
|
|
|
name: 'commandName',
|
|
|
|
label: 'Name',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'description',
|
|
|
|
label: 'Description',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'props',
|
|
|
|
label: 'Props',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
const rows: MarkdownTableRow[] = [];
|
2020-10-18 22:52:10 +02:00
|
|
|
|
|
|
|
for (const commandName in this.commands_) {
|
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
const row: MarkdownTableRow = {
|
2020-10-18 22:52:10 +02:00
|
|
|
commandName: commandName,
|
|
|
|
description: this.label(commandName),
|
|
|
|
};
|
|
|
|
|
|
|
|
rows.push(row);
|
|
|
|
}
|
|
|
|
|
|
|
|
return markdownUtils.createMarkdownTable(headers, rows);
|
|
|
|
}
|