diff --git a/.gitignore b/.gitignore index 5e09b24..36710ce 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,6 @@ x64/ x86/ bld/ -[Bb]in/ [Oo]bj/ [Ll]og/ diff --git a/bin/boomer b/bin/boomer new file mode 100755 index 0000000..66b1a1f --- /dev/null +++ b/bin/boomer @@ -0,0 +1,31 @@ +#!/usr/bin/env node +const program = require('caporal'); +const boomer = require('../index'); + +const pkg = require('../package.json'); +program.version(pkg.version).description(pkg.description); + +program + .argument('', '手机号码') + .option('-f, --forever', '是否持久运行,默认只运行一个周期', program.BOOLEAN, false) + .action((argv, opts) => { + const app = boomer(argv.phone || process.env.PHONE || '13800000000', { once: !opts.forever }); + + process.on('SIGINT', () => { + app.emit('end'); + process.exit(1); + }); + + app + .on('open', () => { + console.info(`broswer launch`); + }) + .on('next', () => { + console.info(`turn to next page...`); + }) + .on('error', err => { + console.error(`error`); + }); + }); + +program.parse(process.argv);