forked from denoland/wasmbuild
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
33 lines (29 loc) · 955 Bytes
/
main.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
32
33
#!/usr/bin/env -S deno run --allow-run --allow-read --allow-write --allow-env
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
import { parseArgs } from "./lib/args.ts";
import { runNewCommand } from "./lib/commands/new_command.ts";
import { runCheckCommand } from "./lib/commands/check_command.ts";
import { runBuildCommand } from "./lib/commands/build_command.ts";
await Deno.permissions.request({ name: "env" });
await Deno.permissions.request({ name: "run" });
await Deno.permissions.request({ name: "read" });
await Deno.permissions.request({ name: "write" });
const command = parseArgs(Deno.args);
switch (command.kind) {
case "new": {
await runNewCommand();
break;
}
case "build": {
await runBuildCommand(command);
break;
}
case "check": {
await runCheckCommand(command);
break;
}
default: {
const _assertNever: never = command;
throw new Error("Not implemented.");
}
}