back/cli: fix main command not able to accept args

This commit is contained in:
Alice Gaudon 2021-11-24 18:18:19 +01:00
parent e1542ae476
commit 4c895229ec

View File

@ -247,6 +247,7 @@ export default abstract class Application implements Extendable<ApplicationCompo
protected async processCommandLine(): Promise<boolean> { protected async processCommandLine(): Promise<boolean> {
const args = process.argv; const args = process.argv;
// Flags // Flags
const flags = { const flags = {
verbose: false, verbose: false,
@ -272,10 +273,14 @@ export default abstract class Application implements Extendable<ApplicationCompo
else throw new Error(`Only one main command can be used at once (${mainCommand},${args[i]})`); else throw new Error(`Only one main command can be used at once (${mainCommand},${args[i]})`);
break; break;
default: default:
if (mainCommand) mainCommandArgs.push(args[i]); if (mainCommand) {
else logger.fatal('Unrecognized argument', args[i]); mainCommandArgs.push(args[i]);
} else {
logger.fatal('Unrecognized argument', args[i]);
return true; return true;
} }
break;
}
} }
if (flags.verbose) logger.setSettings({minLevel: "trace"}); if (flags.verbose) logger.setSettings({minLevel: "trace"});