From 702d41af0c5d2c6ab8969a22d5647dab9f34f5da Mon Sep 17 00:00:00 2001 From: falstack Date: Fri, 8 Oct 2021 22:15:49 +0800 Subject: [PATCH] fix: remove `version` from the help message for sub commands (#126) --- src/Command.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Command.ts b/src/Command.ts index 11ee87e..005c37c 100644 --- a/src/Command.ts +++ b/src/Command.ts @@ -180,9 +180,12 @@ class Command { }) } - const options = this.isGlobalCommand + let options = this.isGlobalCommand ? globalOptions : [...this.options, ...(globalOptions || [])] + if (!this.isGlobalCommand) { + options = options.filter((option) => option.name !== 'version') + } if (options.length > 0) { const longestOptionName = findLongest( options.map((option) => option.rawName)