Skip to content

Commit 68b523a

Browse files
authored
feat: update cliffy and add SANDBOX_ID env var support (#73)
1 parent 8b92b9e commit 68b523a

3 files changed

Lines changed: 49 additions & 32 deletions

File tree

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"exports": "./main.ts",
1717
"imports": {
1818
"@cfa/gitignore-parser": "jsr:@cfa/gitignore-parser@^0.1.4",
19-
"@cliffy/command": "jsr:@cliffy/command@^1.0.0-rc.8",
19+
"@cliffy/command": "jsr:@cliffy/command@^1.0.0",
2020
"@deno/sandbox": "jsr:@deno/sandbox@^0.10.0",
2121
"@std/assert": "jsr:@std/assert@^1.0.16",
2222
"@std/async": "jsr:@std/async@^1.1.0",

deno.lock

Lines changed: 30 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sandbox/mod.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ export const sandboxListCommand = new Command<SandboxContext>()
233233

234234
export const sandboxKillCommand = new Command<SandboxContext>()
235235
.description("Kill a running sandbox")
236-
.arguments("<sandbox-id:string>")
236+
.argument("<sandbox-id:string>", "The id of the sandbox", {
237+
default: Deno.env.get("SANDBOX_ID"),
238+
})
237239
.action(actionHandler(async (config, options, sandboxId) => {
238240
config.noCreate();
239241
const org = await getOrg(options, config, options.org);
@@ -257,7 +259,9 @@ export const sandboxKillCommand = new Command<SandboxContext>()
257259

258260
export const sandboxSshCommand = new Command<SandboxContext>()
259261
.description("SSH into a running sandbox")
260-
.arguments("<sandbox-id:string>")
262+
.argument("<sandbox-id:string>", "The id of the sandbox", {
263+
default: Deno.env.get("SANDBOX_ID"),
264+
})
261265
.action(actionHandler(async (config, options, sandboxId) => {
262266
config.noCreate();
263267
await using sandbox = await connectToSandbox(options, config, sandboxId);
@@ -433,7 +437,10 @@ export const sandboxExecCommand = new Command<SandboxContext>()
433437
)
434438
.option("-q, --quiet", "Don't pipe the command to the console")
435439
.option("--cwd <path:string>", "Working directory of the command")
436-
.arguments("<sandbox-id:string> <command...:string>")
440+
.argument("<sandbox-id:string>", "The id of the sandbox", {
441+
default: Deno.env.get("SANDBOX_ID"),
442+
})
443+
.arguments("<command...:string>")
437444
.action(
438445
actionHandler(async function (config, options, sandboxId, ...command) {
439446
config.noCreate();
@@ -461,7 +468,10 @@ export const sandboxExecCommand = new Command<SandboxContext>()
461468

462469
export const sandboxExtendCommand = new Command<SandboxContext>()
463470
.description("Extend the timeout of a running sandbox")
464-
.arguments("<sandbox-id:string> <timeout:string>")
471+
.argument("<sandbox-id:string>", "The id of the sandbox", {
472+
default: Deno.env.get("SANDBOX_ID"),
473+
})
474+
.argument("<timeout:string>", "The amount to extend the timeout by")
465475
.action(actionHandler(async (config, options, sandboxId, timeout) => {
466476
config.noCreate();
467477
await using sandbox = await connectToSandbox(options, config, sandboxId);
@@ -479,7 +489,10 @@ export const sandboxDeployCommand = new Command<SandboxContext>()
479489
"--args <args...:string>",
480490
"Arguments to pass to the entrypoint script",
481491
)
482-
.arguments("<sandbox-id:string> <app:string>")
492+
.argument("<sandbox-id:string>", "The id of the sandbox", {
493+
default: Deno.env.get("SANDBOX_ID"),
494+
})
495+
.argument("<app:string>", "The app to deploy to")
483496
.action(actionHandler(async (config, options, sandboxId, app) => {
484497
config.noCreate();
485498
await using sandbox = await connectToSandbox(options, config, sandboxId);

0 commit comments

Comments
 (0)