forked from fastify/fastify-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
executable file
·26 lines (21 loc) · 622 Bytes
/
cli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#! /usr/bin/env node
'use strict'
const path = require('path')
const commist = require('commist')()
const help = require('help-me')({
// the default
dir: path.join(path.dirname(require.main.filename), 'help')
})
const start = require('./start')
const generate = require('./generate')
commist.register('start', start.cli)
commist.register('generate', generate.cli)
commist.register('help', help.toStdout)
commist.register('version', function () {
console.log(require('./package.json').version)
})
const res = commist.parse(process.argv.splice(2))
if (res) {
// no command was recognized
help.toStdout(res)
}