1 | #!/usr/bin/env node
|
2 |
|
3 | require('hard-rejection/register')
|
4 | const yargs = require('yargs')
|
5 | const updateNotifier = require('update-notifier')
|
6 | const normalizeData = require('normalize-package-data')
|
7 | const {fromUrl} = require('hosted-git-info')
|
8 | const pkg = require('../package.json')
|
9 | const {join} = require('path')
|
10 |
|
11 | async 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 |
|
27 | cli()
|