-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.ts
31 lines (26 loc) · 937 Bytes
/
run.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
// Entrypoint to run "just tell me" from the command line interface.
import { getAppConfig } from "./app/src/app-config.ts";
import { Result } from "./app/src/result.ts";
import { parseArgs } from "https://deno.land/[email protected]/cli/parse_args.ts";
async function run() {
const argument = Deno.args[0];
if (argument === undefined) {
console.log("This script expects a YouTube video id");
return;
}
const videoId: string = argument;
const flags = parseArgs(Deno.args, {
string: ["model"],
});
const appConfigResult = await getAppConfig(flags.model);
if (appConfigResult.result === Result.Failure) {
console.log(appConfigResult.failure, "\n", appConfigResult.message);
} else {
const appConfig = appConfigResult.data;
const summaryResult = await appConfig.getYoutubeVideoSummary(videoId);
if (summaryResult.result === Result.Ok) {
console.log(summaryResult.data);
}
}
}
run();