-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
43 lines (40 loc) · 1011 Bytes
/
cli.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
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env node
const argv = require("yargs")
.usage("Usage: $0 [options]")
.option("g", {
alias: "projectID",
type: "string",
describe: "Google cloud project id, where the service account is created"
})
.option("p", {
alias: "packageName",
type: "string",
describe: "Target app package name"
})
.option("b", {
alias: "bucketName",
type: "string",
describe:
"Bucket name, check Google play console -> Download reports -> Statistics -> Cloud storage URI"
})
.option("k", {
alias: "key",
type: "string",
describe: "Service account file path",
demand: true
})
.help("h").argv;
const options = {
projectID: argv.projectID,
keyFilePath: argv.key,
bucketName: argv.bucketName,
packageName: argv.packageName
};
const GooglePlayStoreStatsViewer = require("./index");
new GooglePlayStoreStatsViewer(options)
.getAppStats()
.catch(err => {
console.error(err);
process.exit(1);
})
.then(obj => console.log(obj));