-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.ts
29 lines (27 loc) · 840 Bytes
/
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
import { parse } from "https://deno.land/[email protected]/flags/mod.ts";
import { Options, wakeDyno } from "./mod.ts";
if (import.meta.main) {
if (Deno.args.length > 0) {
const args = parse(Deno.args);
const options: Options = {
interval: args.interval ?? 29,
...(args.stopStart || args.stopEnd) && {
stopTimes: {
start: args.stopStart,
end: args.stopEnd
}
}
}
const url = args.url;
if (url) {
wakeDyno(url, options);
}
let urls = args.urls;
if (urls) {
urls = args.urls.split(',');
wakeDyno(urls, options);
}
} else {
console.log('Usage:\n$ heroku-awakener --url <url> --interval <interval> --stopStart <start> --stopEnd <end>\n$ heroku-awakener --urls <urls> --interval <interval> --stopStart <start> --stopEnd <end>')
}
}