forked from ronkorving/google-play-publisher
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·49 lines (42 loc) · 1.05 KB
/
Copy pathcli.js
File metadata and controls
executable file
·49 lines (42 loc) · 1.05 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env node
var argv = require('yargs')
.usage('Usage: $0 [options]')
.demand(1)
.option('t', {
alias: 'track',
type: 'string',
default: 'alpha'
})
.option('a', {
alias: 'auth',
describe: 'JSON file that contains private key and client email',
demand: true
})
.option('r', {
alias: 'recent-changes',
type: 'array'
})
.help('h')
.argv
var fs = require('fs')
var assert = require('assert')
var authJSON = JSON.parse(fs.readFileSync(argv.auth)) // assume a JSON
var options = {
track: argv.track,
obbs: argv._.slice(1)
}
if (argv.recentChanges) {
options.recentChanges = {}
argv.recentChanges.forEach(function (change) {
assert.notEqual(change.indexOf('='), -1, 'Unable to parse recent changes')
var parts = change.split('=')
assert.equal(parts.length, 2, 'Unable to parse recent changes')
options.recentChanges[parts[0]] = parts[1]
})
}
var publisher = require('./lib')(authJSON)
publisher.upload(argv._[0], options)
.catch(function (err) {
console.error(err.stack)
process.exit(1)
})