From d4004a76182f62e483b4371b3fd9ca2cd9da57d2 Mon Sep 17 00:00:00 2001 From: Frankie Wittevrongel Date: Sun, 25 Jul 2021 14:19:31 +0100 Subject: [PATCH 1/3] Fix wrapping when scriptName is empty string --- lib/usage.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/usage.ts b/lib/usage.ts index 807625ae8..7b8ed5f33 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. @@ -256,7 +258,7 @@ export function usage(yargs: YargsInstance, shim: PlatformShim) { text: commandString, padding: [0, 2, 0, 2], width: - maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4, + maxWidth(commands, theWrap, `${prefix}${parentCommands}`) + 4, }, {text: command[1]} ); From 1ddfe33d481a94362fc3f5dc541bfdd748506fa9 Mon Sep 17 00:00:00 2001 From: Frankie Wittevrongel Date: Sat, 7 Aug 2021 04:25:07 +0100 Subject: [PATCH 2/3] Update usage.ts --- lib/usage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/usage.ts b/lib/usage.ts index 7b8ed5f33..201286a31 100644 --- a/lib/usage.ts +++ b/lib/usage.ts @@ -258,7 +258,7 @@ export function usage(yargs: YargsInstance, shim: PlatformShim) { text: commandString, padding: [0, 2, 0, 2], width: - maxWidth(commands, theWrap, `${prefix}${parentCommands}`) + 4, + maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4, }, {text: command[1]} ); From 64e38d6f1e7114ba93ce5598a4c301e37c13aca7 Mon Sep 17 00:00:00 2001 From: Frankie Wittevrongel Date: Sat, 14 Aug 2021 01:05:58 +0100 Subject: [PATCH 3/3] Add semi-colon --- lib/usage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/usage.ts b/lib/usage.ts index b0dbdb184..9374d2d16 100644 --- a/lib/usage.ts +++ b/lib/usage.ts @@ -246,7 +246,7 @@ export function usage(yargs: YargsInstance, shim: PlatformShim) { commands = commands.sort((a, b) => a[0].localeCompare(b[0])); } - const prefix = base$0 ? `${base$0} ` : '' + const prefix = base$0 ? `${base$0} ` : ''; commands.forEach(command => { const commandString = `${prefix}${parentCommands}${command[0].replace(