diff options
| author | Max Isom <[email protected]> | 2020-03-18 19:01:18 -0500 |
|---|---|---|
| committer | Max Isom <[email protected]> | 2020-03-18 19:01:18 -0500 |
| commit | a0c5875ee43166a9565e4a086a701864c52f549d (patch) | |
| tree | abce399a8ce0244155ad650e39822cf2488d75ca | |
| parent | de1e761623f27c6ed0277d85d824c504c39a1188 (diff) | |
| download | muse-a0c5875ee43166a9565e4a086a701864c52f549d.tar.xz muse-a0c5875ee43166a9565e4a086a701864c52f549d.zip | |
Add aliases to help
| -rw-r--r-- | src/commands/help.ts | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/commands/help.ts b/src/commands/help.ts index 5e25070..90c5d98 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -30,7 +30,21 @@ export default class implements Command { const {prefix} = settings; const res = this.commands.sort((a, b) => a.name.localeCompare(b.name)).reduce((content, command) => { - content += `**${command.name}**:\n`; + const aliases = command.aliases.reduce((str, alias, i) => { + str += alias; + + if (i !== command.aliases.length - 1) { + str += ', '; + } + + return str; + }, ''); + + if (aliases === '') { + content += `**${command.name}**:\n`; + } else { + content += `**${command.name}** (${aliases}):\n`; + } command.examples.forEach(example => { content += `- \`${prefix}${example[0]}\`: ${example[1]}\n`; |
