Skip to content

Commit

Permalink
feat: add bin
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Oct 25, 2017
1 parent a44f481 commit 6da96de
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

Expand Down
31 changes: 31 additions & 0 deletions bin/boomer
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);

0 comments on commit 6da96de

Please sign in to comment.