Skip to content

Commit

Permalink
[Enhancement] edited commandsReadMe function to take second parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
naseif committed Nov 30, 2021
1 parent ddf28a7 commit 54334f3
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions modules/commandsReadMe.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ const { writeFileSync } = require("fs");
* @returns New File containng the commands table
*/

module.exports.commandsReadMe = (commands) => {
module.exports.commandsReadMe = (commands, category) => {
const tableData = {
header: ["Name", "Description"],
alignment: ["L", "C"],
header: ["Name", "Description", "Arguments"],
alignment: ["L", "C", "C"],
rows: [],
};
const tableSettings = {
Expand All @@ -19,13 +19,17 @@ module.exports.commandsReadMe = (commands) => {
};

commands.map((command) => {
tableData.rows.push([
`**/${command.data.name}**`,
command.data.description,
]);
if (command.name === undefined) return;
if (command.category === category) {
tableData.rows.push([
`**${command?.name}**`,
command?.description,
command?.args ? command.args : "false",
]);
}
});

const commandsTable = mdtable(tableData, tableSettings);

writeFileSync("./Commands.md", commandsTable, "utf-8");
writeFileSync("./Commands1.md", commandsTable, "utf-8");
};

0 comments on commit 54334f3

Please sign in to comment.