-
Notifications
You must be signed in to change notification settings - Fork 5
/
a2pair.js
executable file
·33 lines (30 loc) · 1.12 KB
/
a2pair.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env node
var co = require('co');
var prompt = require('co-prompt');
var program = require('commander');
var request = require('request');
var allow2 = require('./index.js');
program
.arguments('<device token> <device name>')
.option('-u, --username <username>', 'The allow2 parent account user to authenticate as')
.option('-p, --password <password>', 'The allow2 parent account user\'s password')
.option('-s, --staging', 'Use the staging server, not production')
.action(pair)
.parse(process.argv);
function pair(deviceToken, deviceName) {
/*co(function *() {
var username = yield prompt('username: ');
var password = yield prompt.password('password: ');
console.log('user: %s pass: %s file: %s', username, password, deviceName);
});*/
//console.log('user: %s pass: %s file: %s', program.username, program.password, deviceName);
allow2.pair({
user: program.username,
pass: program.password,
staging: program.staging,
deviceToken: deviceToken,
deviceName: deviceName
}, function(err, response){
console.log(err, response);
});
}