@pocketenv/cli 0.2.5 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +425 -50
- package/package.json +1 -1
- package/src/cmd/create.ts +3 -3
- package/src/cmd/env.ts +8 -8
- package/src/cmd/expose.ts +38 -0
- package/src/cmd/file.ts +139 -0
- package/src/cmd/list.ts +7 -7
- package/src/cmd/ports.ts +63 -0
- package/src/cmd/secret.ts +34 -19
- package/src/cmd/tailscale.ts +6 -6
- package/src/cmd/unexpose.ts +31 -0
- package/src/cmd/volume.ts +123 -0
- package/src/cmd/vscode.ts +32 -0
- package/src/index.ts +99 -10
- package/src/theme.ts +12 -0
- package/src/types/port.ts +5 -0
package/src/index.ts
CHANGED
|
@@ -14,16 +14,14 @@ import { deleteSecret, listSecrets, putSecret } from "./cmd/secret";
|
|
|
14
14
|
import { deleteEnv, listEnvs, putEnv } from "./cmd/env";
|
|
15
15
|
import { getSshKey, putKeys } from "./cmd/sshkeys";
|
|
16
16
|
import { getTailscaleAuthKey, putAuthKey } from "./cmd/tailscale";
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
sky: (s: string) => chalk.rgb(0, 210, 255)(s),
|
|
26
|
-
};
|
|
17
|
+
import { exposePort } from "./cmd/expose";
|
|
18
|
+
import { unexposePort } from "./cmd/unexpose";
|
|
19
|
+
import { createVolume, deleteVolume, listVolumes } from "./cmd/volume";
|
|
20
|
+
import { deleteFile, listFiles, putFile } from "./cmd/file";
|
|
21
|
+
import consola from "consola";
|
|
22
|
+
import { listPorts } from "./cmd/ports";
|
|
23
|
+
import { c } from "./theme";
|
|
24
|
+
import { exposeVscode } from "./cmd/vscode";
|
|
27
25
|
|
|
28
26
|
const program = new Command();
|
|
29
27
|
|
|
@@ -112,6 +110,97 @@ program
|
|
|
112
110
|
.description("delete the given sandbox")
|
|
113
111
|
.action(deleteSandbox);
|
|
114
112
|
|
|
113
|
+
program
|
|
114
|
+
.command("vscode")
|
|
115
|
+
.argument("<sandbox>", "the sandbox to expose VS Code for")
|
|
116
|
+
.description(
|
|
117
|
+
"expose a VS Code Server instance running in the given sandbox to the internet",
|
|
118
|
+
)
|
|
119
|
+
.action(exposeVscode);
|
|
120
|
+
|
|
121
|
+
program
|
|
122
|
+
.command("expose")
|
|
123
|
+
.argument("<sandbox>", "the sandbox to expose a port for")
|
|
124
|
+
.argument("<port>", "the port to expose", (val) => {
|
|
125
|
+
const port = parseInt(val, 10);
|
|
126
|
+
if (isNaN(port)) {
|
|
127
|
+
consola.error(`port must be a number, got: ${val}`);
|
|
128
|
+
process.exit(1);
|
|
129
|
+
}
|
|
130
|
+
return port;
|
|
131
|
+
})
|
|
132
|
+
.argument("[description]", "an optional description for the exposed port")
|
|
133
|
+
.description("expose a port from the given sandbox to the internet")
|
|
134
|
+
.action(exposePort);
|
|
135
|
+
|
|
136
|
+
program
|
|
137
|
+
.command("unexpose")
|
|
138
|
+
.argument("<sandbox>", "the sandbox to unexpose a port for")
|
|
139
|
+
.argument("<port>", "the port to unexpose", (val) => {
|
|
140
|
+
const port = parseInt(val, 10);
|
|
141
|
+
if (isNaN(port)) {
|
|
142
|
+
consola.error(`port must be a number, got: ${val}`);
|
|
143
|
+
process.exit(1);
|
|
144
|
+
}
|
|
145
|
+
return port;
|
|
146
|
+
})
|
|
147
|
+
.description("unexpose a port from the given sandbox")
|
|
148
|
+
.action(unexposePort);
|
|
149
|
+
|
|
150
|
+
const volume = program.command("volume").description("manage volumes");
|
|
151
|
+
|
|
152
|
+
volume
|
|
153
|
+
.command("put")
|
|
154
|
+
.argument("<sandbox>", "the sandbox to put the volume in")
|
|
155
|
+
.argument("<name>", "the name of the volume")
|
|
156
|
+
.argument("<path>", "the path to mount the volume at")
|
|
157
|
+
.description("put a volume in the given sandbox")
|
|
158
|
+
.action(createVolume);
|
|
159
|
+
|
|
160
|
+
volume
|
|
161
|
+
.command("list")
|
|
162
|
+
.aliases(["ls"])
|
|
163
|
+
.argument("<sandbox>", "the sandbox to list volumes for")
|
|
164
|
+
.description("list volumes in the given sandbox")
|
|
165
|
+
.action(listVolumes);
|
|
166
|
+
|
|
167
|
+
volume
|
|
168
|
+
.command("delete")
|
|
169
|
+
.aliases(["rm", "remove"])
|
|
170
|
+
.argument("<id>", "the ID of the volume to delete")
|
|
171
|
+
.description("delete a volume")
|
|
172
|
+
.action(deleteVolume);
|
|
173
|
+
|
|
174
|
+
const file = program.command("file").description("manage files");
|
|
175
|
+
|
|
176
|
+
file
|
|
177
|
+
.command("put")
|
|
178
|
+
.argument("<sandbox>", "the sandbox to put the file in")
|
|
179
|
+
.argument("<path>", "the remote path to upload the file to")
|
|
180
|
+
.argument("[localPath]", "the local path of the file to upload")
|
|
181
|
+
.description("upload a file to the given sandbox")
|
|
182
|
+
.action(putFile);
|
|
183
|
+
|
|
184
|
+
file
|
|
185
|
+
.command("list")
|
|
186
|
+
.aliases(["ls"])
|
|
187
|
+
.argument("<sandbox>", "the sandbox to list files for")
|
|
188
|
+
.description("list files in the given sandbox")
|
|
189
|
+
.action(listFiles);
|
|
190
|
+
|
|
191
|
+
file
|
|
192
|
+
.command("delete")
|
|
193
|
+
.aliases(["rm", "remove"])
|
|
194
|
+
.argument("<id>", "the ID of the file to delete")
|
|
195
|
+
.description("delete a file")
|
|
196
|
+
.action(deleteFile);
|
|
197
|
+
|
|
198
|
+
program
|
|
199
|
+
.command("ports")
|
|
200
|
+
.argument("<sandbox>", "the sandbox to list exposed ports for")
|
|
201
|
+
.description("list exposed ports for a sandbox")
|
|
202
|
+
.action(listPorts);
|
|
203
|
+
|
|
115
204
|
const secret = program.command("secret").description("manage secrets");
|
|
116
205
|
|
|
117
206
|
secret
|
package/src/theme.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
|
|
3
|
+
export const c = {
|
|
4
|
+
primary: (s: string | number) => chalk.rgb(0, 232, 198)(s),
|
|
5
|
+
secondary: (s: string | number) => chalk.rgb(0, 198, 232)(s),
|
|
6
|
+
accent: (s: string | number) => chalk.rgb(130, 100, 255)(s),
|
|
7
|
+
highlight: (s: string | number) => chalk.rgb(100, 232, 130)(s),
|
|
8
|
+
muted: (s: string | number) => chalk.rgb(200, 210, 220)(s),
|
|
9
|
+
link: (s: string | number) => chalk.rgb(255, 160, 100)(s),
|
|
10
|
+
sky: (s: string | number) => chalk.rgb(0, 210, 255)(s),
|
|
11
|
+
error: (s: string | number) => chalk.rgb(255, 100, 100)(s),
|
|
12
|
+
};
|