1
0
Fork 0

fix(main): log env and version on startup

This commit is contained in:
ssube 2020-08-11 23:09:21 -05:00
parent d510a3afb3
commit c1394f307f
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
1 changed files with 22 additions and 12 deletions

View File

@ -1,6 +1,9 @@
import { InvalidArgumentError } from '@apextoaster/js-utils';
import { Commands, createParser } from './config/args'; import { Commands, createParser } from './config/args';
import { GithubRemote } from './remote/github'; import { GithubRemote } from './remote/github';
import { syncIssues, syncLabels, SyncOptions } from './sync'; import { syncIssues, syncLabels, SyncOptions } from './sync';
import { VERSION_INFO } from './version';
export { FlagLabel, StateLabel } from './labels'; export { FlagLabel, StateLabel } from './labels';
export { Remote, RemoteOptions } from './remote'; export { Remote, RemoteOptions } from './remote';
@ -17,24 +20,31 @@ export async function main(argv: Array<string>): Promise<number> {
const parser = createParser((argMode) => mode = argMode as Commands); const parser = createParser((argMode) => mode = argMode as Commands);
const args = parser.parse(argv.slice(SLICE_ARGS)); const args = parser.parse(argv.slice(SLICE_ARGS));
/* eslint-disable no-console */
console.log('mode:', mode);
console.log('args:', args);
// load config // load config
const config = {
colors: [],
flags: [],
remotes: [],
states: [],
};
/* eslint-disable-next-line no-console */
console.log({
args,
config,
mode,
version: VERSION_INFO,
});
// create logger // create logger
// create remote // create remote
const remote = new GithubRemote();
// mode switch // mode switch
const options: SyncOptions = { const options: SyncOptions = {
config: { config,
colors: [],
flags: [],
remotes: [],
states: [],
},
project: '', project: '',
remote: new GithubRemote(), remote,
}; };
switch (mode) { switch (mode) {
case Commands.ISSUES: case Commands.ISSUES:
@ -44,7 +54,7 @@ export async function main(argv: Array<string>): Promise<number> {
await syncLabels(options); await syncLabels(options);
break; break;
default: default:
console.log('unknown command'); throw new InvalidArgumentError('unknown mode');
} }
return 0; return 0;