From d33e9972291406490cd8fdad0b3589be234e0f12 Mon Sep 17 00:00:00 2001 From: Frankie Wittevrongel Date: Mon, 16 Aug 2021 16:24:14 +0100 Subject: [PATCH] fix: help command spacing when scriptName is empty (#1994) --- lib/usage.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/usage.ts b/lib/usage.ts index 1426c4337..9374d2d16 100644 --- a/lib/usage.ts +++ b/lib/usage.ts @@ -246,8 +246,10 @@ export function usage(yargs: YargsInstance, shim: PlatformShim) { commands = commands.sort((a, b) => a[0].localeCompare(b[0])); } + const prefix = base$0 ? `${base$0} ` : ''; + commands.forEach(command => { - const commandString = `${base$0} ${parentCommands}${command[0].replace( + const commandString = `${prefix}${parentCommands}${command[0].replace( /^\$0 ?/, '' )}`; // drop $0 from default commands.