forked from mirrors/probot
feat: warn on passing in unknown commands
This commit is contained in:
parent
5b86e1bb6a
commit
f368013729
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
const semver = require('semver')
|
const semver = require('semver')
|
||||||
|
const program = require('commander')
|
||||||
const version = require('../package').engines.node
|
const version = require('../package').engines.node
|
||||||
|
|
||||||
if (!semver.satisfies(process.version, version)) {
|
if (!semver.satisfies(process.version, version)) {
|
||||||
|
@ -8,9 +9,16 @@ if (!semver.satisfies(process.version, version)) {
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
require('commander')
|
program
|
||||||
.version(require('../package').version)
|
.version(require('../package').version)
|
||||||
.usage('<command> [options]')
|
.usage('<command> [options]')
|
||||||
.command('run', 'run the bot')
|
.command('run', 'run the bot')
|
||||||
.command('receive', 'Receive a single event and payload')
|
.command('receive', 'Receive a single event and payload')
|
||||||
|
|
||||||
|
program.on('command:*', (cmd) => {
|
||||||
|
console.log(`\nInvalid command ${cmd}\n`)
|
||||||
|
program.outputHelp()
|
||||||
|
})
|
||||||
|
|
||||||
|
program
|
||||||
.parse(process.argv)
|
.parse(process.argv)
|
||||||
|
|
Loading…
Reference in New Issue