This repository was archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.ts
More file actions
62 lines (54 loc) · 1.3 KB
/
cli.ts
File metadata and controls
62 lines (54 loc) · 1.3 KB
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
import { gray, yellow } from "jsr:@std/fmt/colors";
import denoConfig from "./deno.json" with { type: "json" };
import Init from "./options/init.ts";
import Install from "./options/install.ts";
import Build from "./options/build.ts";
const args = Deno.args.map((a) => a.toLowerCase());
const prefix = gray("[Despace]");
console.warn(
`${prefix} ${
yellow(
"Despace is now deprecated in favor of Deno's built in workspace support.",
)
}`,
);
switch (args[0]) {
case "init": {
await Init(args);
break;
}
case "build": {
await Build(args);
break;
}
case "help": {
console.log(
`${prefix} Available commands: \n\t `,
[
"init [file | --make] - Initialize Despace in the current directory.",
"build [--watch] - Build the current project.",
"update - Update to the latest version of Despace.",
"version - Display the current version of Despace.",
"help - Display this message.",
].join("\n\t "),
);
break;
}
case "update":
case "install": {
await Install(args);
break;
}
default: {
if (args[0] != undefined && args[0] != "version") {
console.error(
`${prefix} Unknown command \`${
args[0]
}\`, run \`despace help\` for a list of commands.`,
);
} else {
console.log(`${prefix} Running version ${denoConfig.version}`);
}
break;
}
}