fix(misc): fix --help for generators and executors

This commit is contained in:
Victor Savkin 2023-01-06 09:37:25 -05:00
parent d0d6e854d4
commit 187f2a13ae

View File

@ -23,7 +23,10 @@ export function initLocal(workspace: WorkspaceTypeAndRoot) {
return; return;
} }
if (isKnownCommand()) { const command = process.argv[2];
if (command === 'run' || command === 'g' || command === 'generate') {
commandsObject.parse(process.argv.slice(2));
} else if (isKnownCommand(command)) {
const newArgs = rewriteTargetsAndProjects(process.argv); const newArgs = rewriteTargetsAndProjects(process.argv);
const help = newArgs.indexOf('--help'); const help = newArgs.indexOf('--help');
const split = newArgs.indexOf('--'); const split = newArgs.indexOf('--');
@ -89,7 +92,7 @@ function wrapIntoQuotesIfNeeded(arg: string) {
return arg.indexOf(':') > -1 ? `"${arg}"` : arg; return arg.indexOf(':') > -1 ? `"${arg}"` : arg;
} }
function isKnownCommand() { function isKnownCommand(command: string) {
const commands = [ const commands = [
...Object.keys( ...Object.keys(
(commandsObject as any) (commandsObject as any)
@ -106,11 +109,7 @@ function isKnownCommand() {
'clear-cache', 'clear-cache',
'help', 'help',
]; ];
return ( return !command || command.startsWith('-') || commands.indexOf(command) > -1;
!process.argv[2] ||
process.argv[2].startsWith('-') ||
commands.indexOf(process.argv[2]) > -1
);
} }
function shouldDelegateToAngularCLI() { function shouldDelegateToAngularCLI() {