-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbyteos
executable file
·32 lines (26 loc) · 1.1 KB
/
byteos
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
#!/usr/bin/env -S deno --ext=ts --allow-run --allow-read --allow-env
import { Command } from "https://deno.land/x/[email protected]/command/mod.ts";
import { cliCommand as buildCommand } from './scripts/cli-build.ts';
import { cliCommand as qemuCommand } from './scripts/cli-qemu.ts';
import { logLevelEnum, archEnum } from './scripts/cli-types.ts';
import { parse } from "jsr:@std/yaml";
const command = new Command()
.name("byteos")
.version("0.1.0")
.description("Building tools for the byteos.")
.globalType("log-level", logLevelEnum)
.globalOption("-l, --log-level <level:log-level>", "Set Log Level", { default: 'info' })
.globalType("architecture", archEnum)
.globalOption("-a, --arch [arch:architecture]", "Set the architecture", { required: true })
// Sub Command build
.command("build", buildCommand)
.command("qemu", qemuCommand);
// parse yaml file
const data = parse(new TextDecoder("utf-8").decode(await Deno.readFile("byteos.yaml")));
console.log(data);
try {
// Parse the command.
await command.parse(Deno.args);
} catch (e) {
console.error("Error", e);
}