Skip to content

Commit

Permalink
fix(@angular/cli): add text to help output to indicate that additiona…
Browse files Browse the repository at this point in the history
…l commands are available when ran in different context

With this change we add a footer to indicate that more commands are available when running the CLI in a different context. Ie inside or outside of a workspace.

(cherry picked from commit cefbffe)
  • Loading branch information
alan-agius4 authored and clydin committed Jun 3, 2022
1 parent 66a1d6b commit e4fb966
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/angular/cli/src/command-builder/command-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ export async function runCommand(args: string[], logger: logging.Logger): Promis
'deprecated: %s': colors.yellow('deprecated:') + ' %s',
'Did you mean %s?': 'Unknown command. Did you mean %s?',
})
.epilogue(colors.gray(getEpilogue(!!workspace)))
.demandCommand(1, demandCommandFailureMessage)
.recommendCommands()
.middleware(normalizeOptionsMiddleware)
Expand All @@ -173,3 +174,18 @@ export async function runCommand(args: string[], logger: logging.Logger): Promis

return process.exitCode ?? 0;
}

function getEpilogue(isInsideWorkspace: boolean): string {
let message: string;
if (isInsideWorkspace) {
message =
'The above commands are available when running the Angular CLI inside a workspace.' +
'More commands are available when running outside a workspace.\n';
} else {
message =
'The above commands are available when running the Angular CLI outside a workspace.' +
'More commands are available when running inside a workspace.\n';
}

return message + 'For more information, see https://angular.io/cli/.\n';
}

0 comments on commit e4fb966

Please sign in to comment.