-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkaren.ts
executable file
·64 lines (55 loc) · 1.67 KB
/
karen.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#! /usr/bin/env -S deno run --allow-run --allow-env --allow-read --allow-write --allow-net --unstable-kv
import { Command } from "npm:commander";
import { Console } from "./src/Console.ts";
import { getSettings, getStorage, touchStorageDir } from "./src/System.ts";
import {
ConfigCommand,
DiffCommand,
EditCommand,
GetCommand,
InfoCommand,
ListCommand,
PathCommand,
PruneCommand,
PullCommand,
PushCommand,
RemoveCommand,
ReviewCommand,
SettingsCommand,
} from "./src/Command.ts";
const console = Console();
export async function main() {
const storageDir = await touchStorageDir();
const storage = await getStorage(storageDir)
.catch((err) => {
console.error(err);
console.error("Failed to initialize storage");
Deno.exit(1);
});
const settings = await getSettings(storageDir)
.catch((err) => {
console.error(err);
console.die("Failed to load settings");
});
const program = new Command();
program
.name("karen")
.description("KAREN: Assisted Review, Estimation, and Nitpicking")
.version("1.0.0");
program
.addCommand(PathCommand(storageDir))
.addCommand(SettingsCommand(settings))
.addCommand(ConfigCommand(storage))
.addCommand(InfoCommand(storage))
.addCommand(ListCommand(storage, settings))
.addCommand(GetCommand(storage))
.addCommand(RemoveCommand(storage))
.addCommand(PushCommand(storage))
.addCommand(PullCommand(storage))
.addCommand(ReviewCommand(storage, settings))
.addCommand(EditCommand(storage))
.addCommand(DiffCommand(storage))
.addCommand(PruneCommand(storage));
await program.parseAsync();
}
if (import.meta.main) await main();