Permalink
Browse files

Follow redirects

  • Loading branch information...
Kikobeats committed Apr 29, 2018
1 parent ef7f56a commit fb60fc7bfcd4e9b50f1e0aefa2cad62c250836f3
Showing with 14 additions and 5 deletions.
  1. +14 −5 bin/cli/index.js
@@ -1,15 +1,23 @@
#!/usr/bin/env node
'use strict'
const normalizeUrl = require('normalize-url')
const { first, isEmpty } = require('lodash')
const urlint = require('urlint')
const isCI = require('is-ci')
const got = require('got')
const pkg = require('../../package.json')
const getUrls = require('./get-urls')
const view = require('../view')
const getUrl = async input => {
const normalizedUrl = normalizeUrl(input)
const { url } = await got.head(normalizedUrl)
return url
}
require('update-notifier')({ pkg }).notify()
const cli = require('meow')(require('./help'), {
@@ -59,12 +67,13 @@ if (isEmpty(cli.input)) {
process.exit()
}
const url = normalizeUrl(first(cli.input))
const opts = Object.assign({}, cli.flags, {
whitelist: [].concat(cli.flags.whitelist)
})
;(async () => {
const url = await getUrl(first(cli.input))
const opts = Object.assign({}, cli.flags, {
whitelist: [].concat(cli.flags.whitelist)
})
const urls = await getUrls(url, opts)
const emitter = await urlint(urls, opts)
console.log()

0 comments on commit fb60fc7

Please sign in to comment.