From ed4301a33f19621a32235fa5c663c5de89d6dfbd Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Fri, 25 Feb 2022 14:45:28 -0700 Subject: [PATCH] fix: dont append permutations to this.commands --- src/config/config.ts | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/config/config.ts b/src/config/config.ts index a940798f..3660cbe9 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -431,15 +431,11 @@ export class Config implements IConfig { return collectUsableParts(this.commandIDs) } - getDefinedCommands(): Command.Plugin[] { - return [...this.commandIndex.values()] - } - - getDefinedCommandIDs(): string[] { - return this.getDefinedCommands().map(c => c.id) - } - - get commands(): Command.Plugin[] { + /** + * Returns an array of all commands. If flexible taxonomy is enabled then all permutations will be appended to the array. + * @returns Command.Plugin[] + */ + getAllCommands(): Command.Plugin[] { const commands = [...this.commandIndex.values()] const validPermutations = [...this.permutationIndex.getValid()] for (const permutation of validPermutations) { @@ -452,6 +448,18 @@ export class Config implements IConfig { return commands } + /** + * Returns an array of all command ids. If flexible taxonomy is enabled then all permutations will be appended to the array. + * @returns string[] + */ + getAllCommandIDs(): string[] { + return this.getAllCommands().map(c => c.id) + } + + get commands(): Command.Plugin[] { + return [...this.commandIndex.values()] + } + get commandIDs(): string[] { if (this._commandIDs) return this._commandIDs this._commandIDs = this.commands.map(c => c.id)