Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions packages/angular/cli/src/command-builder/command-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,16 @@ export async function runCommand(args: string[], logger: logging.Logger): Promis
addCommandModuleToYargs(CommandModule, context);
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const usageInstance = (localYargs as any).getInternalMethods().getUsageInstance();
if (jsonHelp) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const usageInstance = (localYargs as any).getInternalMethods().getUsageInstance();
usageInstance.help = () => jsonHelpUsage(localYargs);
} else if (!help) {
// Yargs eagerly caches and formats the full command help (including table wrapping
// and Unicode string-width calculations via cliui) whenever a subcommand executes,
// in case the command fails. Because showHelpOnFail is disabled, this formatted text
// is never used. Skipping this work avoids non-trivial synchronous overhead during startup.
usageInstance.cacheHelpMessage = () => {};
}
Comment thread
clydin marked this conversation as resolved.

// Add default command to support version option when no subcommand is specified
Expand Down