fix(main): log env and version on startup
This commit is contained in:
parent
d510a3afb3
commit
c1394f307f
36
src/main.ts
36
src/main.ts
|
@ -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
|
||||||
// create logger
|
const config = {
|
||||||
// create remote
|
|
||||||
|
|
||||||
// mode switch
|
|
||||||
const options: SyncOptions = {
|
|
||||||
config: {
|
|
||||||
colors: [],
|
colors: [],
|
||||||
flags: [],
|
flags: [],
|
||||||
remotes: [],
|
remotes: [],
|
||||||
states: [],
|
states: [],
|
||||||
},
|
};
|
||||||
|
|
||||||
|
/* eslint-disable-next-line no-console */
|
||||||
|
console.log({
|
||||||
|
args,
|
||||||
|
config,
|
||||||
|
mode,
|
||||||
|
version: VERSION_INFO,
|
||||||
|
});
|
||||||
|
|
||||||
|
// create logger
|
||||||
|
// create remote
|
||||||
|
const remote = new GithubRemote();
|
||||||
|
|
||||||
|
// mode switch
|
||||||
|
const options: SyncOptions = {
|
||||||
|
config,
|
||||||
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;
|
||||||
|
|
Loading…
Reference in New Issue