refactor: explicitly instantiate commander

This commit is contained in:
Karl-Philipp Wulfert
2019-11-25 14:42:22 +01:00
parent 25ff38ef24
commit 554cbfa110

View File

@@ -16,7 +16,7 @@ import {Api} from '@openstapps/gitlab-api';
import {Logger} from '@openstapps/logger';
import {AddLogLevel} from '@openstapps/logger/lib/transformations/add-log-level';
import {Colorize} from '@openstapps/logger/lib/transformations/colorize';
import * as commander from 'commander';
import {Command} from 'commander';
import {existsSync, readFileSync} from 'fs';
import {join, resolve} from 'path';
import {cwd, stdout} from 'process';
@@ -37,6 +37,9 @@ process.on('unhandledRejection', async (reason) => {
process.exit(1);
});
// instantiate new commander
const commander = new Command('openstapps-projectmanagement');
// error on unknown commands
commander.on('command:*', async () => {
await Logger.error('Invalid command: %s\nSee --help for a list of available commands.', commander.args.join(' '));