-
Notifications
You must be signed in to change notification settings - Fork 508
/
Copy pathcli.ts
31 lines (29 loc) · 1.16 KB
/
cli.ts
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
import { index } from ".";
import { Command } from "commander";
import packageJson from "../package.json";
import { green } from "picocolors";
const program = new Command(packageJson.name);
program
.alias("gis")
.version(packageJson.version, "-v, --version", "Output the current version.")
.description(packageJson.description)
.argument("[input]")
.usage(`${green("[input]")} [options]`)
.helpOption("-h, --help", "Output usage information.")
.option("-c, --client-email <email>", "The client email for the Google service account.")
.option("-k, --private-key <key>", "The private key for the Google service account.")
.option("-p, --path <path>", "The path to the Google service account credentials file.")
.option("-u, --urls <urls>", "A comma-separated list of URLs to index.")
.option("--rpm-retry", "Retry when the rate limit is exceeded.")
.action((input, options) => {
index(input, {
client_email: options.clientEmail,
private_key: options.privateKey,
path: options.path,
urls: options.urls ? options.urls.split(",") : undefined,
quota: {
rpmRetry: options.rpmRetry,
},
});
})
.parse(process.argv);