Permalink
Browse files

Refactor

  • Loading branch information...
Kikobeats committed Nov 21, 2018
1 parent f609b82 commit 01b522e8c7d4219718538f5db023fc7334590771
Showing with 24 additions and 22 deletions.
  1. +24 −22 bin/cli/index.js
@@ -68,32 +68,34 @@ const cli = require('meow')(require('./help'), {
}
}
})
;(async () => {
const main = async () => {
const { config = {} } = (await cosmiconfig.search()) || {}
const input = config.url || first(cli.input)
try {
if (isEmpty(input)) {
cli.showHelp()
await build.exit({ buildCode: 1, exitCode: 0 })
}
if (isEmpty(input)) {
cli.showHelp()
await build.exit({ buildCode: 1, exitCode: 0 })
}
const flags = {
...omit(config, ['url']),
...cli.flags
}
const flags = {
...omit(config, ['url']),
...cli.flags
}
const url = await getUrl(input)
const opts = {
...flags,
whitelist: flags.whitelist && concat(flags.whitelist)
}
const url = await getUrl(input)
await build.start()
const emitter = await urlint(url, opts)
view({ emitter, ...opts })
} catch (genericError) {
console.log(beautyError(genericError))
await build.exit({ buildCode: 1, exitCode: 1 })
const opts = {
...flags,
whitelist: flags.whitelist && concat(flags.whitelist)
}
})()
await build.start()
const emitter = await urlint(url, opts)
view({ emitter, ...opts })
}
main().catch(async genericError => {
console.log(beautyError(genericError))
await build.exit({ buildCode: 1, exitCode: 1 })
})

0 comments on commit 01b522e

Please sign in to comment.