From 8245d9c583be7092c76848a7ba95805f3ae0b1f4 Mon Sep 17 00:00:00 2001 From: Jeff Dickey <216188+jdxcode@users.noreply.github.com> Date: Thu, 14 Jun 2018 19:01:37 -0700 Subject: [PATCH] fix: sort commands by id Fixes https://github.com/oclif/oclif/issues/128 --- src/plugin.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugin.ts b/src/plugin.ts index 9dce0015..6293e422 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -116,6 +116,11 @@ export class Plugin implements IPlugin { this.manifest = await this._manifest(!!this.options.ignoreManifest, !!this.options.errorOnManifestCreate) this.commands = Object.entries(this.manifest.commands) .map(([id, c]) => ({...c, load: () => this.findCommand(id, {must: true})})) + this.commands.sort((a, b) => { + if (a.id < b.id) return -1 + if (a.id > b.id) return 1 + return 0 + }) } get topics(): Topic[] { return topicsToArray(this.pjson.oclif.topics || {}) }