Skip to content

Commit

Permalink
fix: dont append permutations to this.commands
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Feb 25, 2022
1 parent 305bf10 commit ed4301a
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/config/config.ts
Expand Up @@ -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) {
Expand All @@ -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)
Expand Down

0 comments on commit ed4301a

Please sign in to comment.