This repository has been archived by the owner on Sep 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This enables users to run the bot via terminal command.
- Loading branch information
1 parent
a614def
commit 703820b
Showing
4 changed files
with
37 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env node | ||
|
||
const minimist = require('minimist') | ||
|
||
require('../lib/cli')(minimist(process.argv.slice(2))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const server = require('./server') | ||
const meta = require('../package.json') | ||
|
||
module.exports = function (args) { | ||
if (args.help) { | ||
showUsage() | ||
process.exit(0) | ||
} else if (args.version) { | ||
showVersion() | ||
process.exit(0) | ||
} else if (args._.length > 0) { | ||
showUsage() | ||
process.exit(-1) | ||
} else { | ||
server() | ||
} | ||
} | ||
|
||
function showUsage () { | ||
console.log(meta.name + ' [--version] [--help]\n') | ||
console.log('\t--version show version info') | ||
console.log('\t--help show this usage info') | ||
} | ||
|
||
function showVersion () { | ||
console.log(meta.name + ' version ' + meta.version) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters