check config in the beginning to avoid doing it all over the place

This commit is contained in:
2020-05-17 09:11:33 +02:00
parent db436587ee
commit abeaacf182
10 changed files with 23 additions and 38 deletions

View File

@@ -3,6 +3,7 @@ import minimist from 'minimist'
import { init } from './config'
import handlers, { error, help } from './handlers'
import { Config } from './types'
@@ -25,14 +26,19 @@ export const { _: commands, ...flags } = minimist(process.argv.slice(2), {
string: ['l', 'b'],
})
export const VERSION = '0.16'
export const VERSION = '0.17'
export const INSTALL_DIR = '/usr/local/bin'
export const VERBOSE = flags.verbose
export const config = init()
export let config: Config
async function main() {
config = await init()
// For dev
// return await handlers['check']([], { ...flags, all: true })
if (commands.length < 1 || commands[0] === 'help') return help()
const command: string = commands[0]