-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
31 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -22,7 +22,6 @@ | |
x64/ | ||
x86/ | ||
bld/ | ||
[Bb]in/ | ||
[Oo]bj/ | ||
[Ll]og/ | ||
|
||
|
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,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('<phone>', '手机号码') | ||
.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); |