-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.ts
81 lines (78 loc) · 2.61 KB
/
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
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import { Command, brightGreen } from "./deps.ts";
import community from "./src/cmd/community.ts";
import down from "./src/cmd/down.ts";
import init from "./src/cmd/init.ts";
import list from "./src/cmd/list.ts";
import logs from "./src/cmd/logs.ts";
import shell from "./src/cmd/shell.ts";
import up from "./src/cmd/up.ts";
import { VERSION } from "./src/consts.ts";
async function main() {
await new Command()
.name("pocketenv")
.version(VERSION)
.description(
brightGreen(`
.
____ __ __
/ __ \\____ _____/ /_____ / /____ ____ _ __
/ /_/ / __ \\/ ___/ //_/ _ \\/ __/ _ \\/ __ \\ | / /
/ ____/ /_/ / /__/ ,< / __/ /_/ __/ / / / |/ /
/_/ \\____/\\___/_/|_|\\___/\\__/\\___/_/ /_/|___/
https://pocketenv.io - Manage your development environment with ease.
`)
)
.command("init", "Generate a new Pocketenv workspace")
.arguments("[name:string]")
.option(
"-t, --template <template:string>",
"Create a workspace from a template"
)
.option(
"-s, --standalone [standalone:boolean]",
"Create a standalone workspace from a template"
)
.action(function (options, name) {
init(options, name);
})
.command("up", "Start the Pocketenv workspace")
.arguments("[workspace:string]")
.option("--ask", "Ask before creating the workspace")
.option(
"-t, --template <template:string>",
"Create and start a workspace from a template"
)
.action(async function (options, workspace) {
await up(options, workspace);
})
.command("down", "Stop the Pocketenv workspace")
.arguments("[workspace:string]")
.option("--ask", "Ask before destroying the workspace")
.action(async function (options, workspace) {
await down(options, workspace);
})
.command("shell", "Start a shell in the Pocketenv workspace")
.arguments("[workspace:string]")
.action(async function (_options, workspace) {
await shell(workspace);
})
.command("logs", "Show the logs of a Pocketenv workspace")
.arguments("[workspace:string]")
.option("-f, --follow", "Follow log output")
.action(async function (options, workspace) {
await logs(options, workspace);
})
.command("list", "List all Pocketenv workspaces")
.action(async function () {
await list();
})
.command("community", "Join our community Discord to chat with us")
.action(async function () {
await community();
})
.parse(Deno.args);
}
// Learn more at https://deno.land/manual/examples/module_metadata#concepts
if (import.meta.main) {
await main();
}