UNPKG

819 BJavaScriptView Raw
1#!/usr/bin/env node
2
3require('hard-rejection/register')
4const yargs = require('yargs')
5const updateNotifier = require('update-notifier')
6const normalizeData = require('normalize-package-data')
7const {fromUrl} = require('hosted-git-info')
8const pkg = require('../package.json')
9const {join} = require('path')
10
11async function cli () {
12 normalizeData(pkg)
13 process.title = Object.keys(pkg.bin)[0]
14 updateNotifier({pkg}).notify()
15 await yargs
16 .usage('Usage: $0 <command>')
17 .example('$0 --help <command>', 'Show command-specific options')
18 .epilogue(`Documentation:\n ${fromUrl(pkg.repository.url).docs()}`)
19 .commandDir(join(__dirname, 'commands'))
20 .demandCommand(1)
21 .help('help').alias('h', 'help')
22 .version().alias('v', 'version')
23 .wrap(null)
24 .parse(process.argv.slice(2))
25}
26
27cli()