Skip to content

Commit d3b1d2d

Browse files
committed
feat: add --version flag and --debug startup message
1 parent d46250a commit d3b1d2d

3 files changed

Lines changed: 25 additions & 1 deletion

File tree

deploy/mod.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Command, ValidationError } from "@cliffy/command";
22
import { green, red, yellow } from "@std/fmt/colors";
33
import { error, renderTemporalTimestamp } from "../util.ts";
44
import { createSwitchCommand, type GlobalContext } from "../main.ts";
5+
import { VERSION } from "../version.ts";
56
import { actionHandler, getApp, getOrg } from "../config.ts";
67
import { publish } from "./publish.ts";
78
import { setupAws, setupGcp } from "./setup-cloud.ts";
@@ -181,6 +182,7 @@ const logoutCommand = new Command()
181182

182183
export const deployCommand = new Command()
183184
.name("deno deploy")
185+
.version(VERSION)
184186
.description(`Interact with Deno Deploy
185187
186188
Calling this subcommand without any further subcommands will
@@ -223,6 +225,14 @@ deploy your local directory to the specified application.`)
223225
if (tokenEnv) {
224226
tokenStorage.set(tokenEnv, true);
225227
}
228+
229+
if (options.debug) {
230+
console.error(
231+
yellow(
232+
`Debug mode is enabled (deno ${Deno.version.deno}, @deno/deploy ${VERSION}, endpoint=${options.endpoint})`,
233+
),
234+
);
235+
}
226236
})
227237
.action(
228238
actionHandler(

sandbox/mod.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
type VolumeId,
66
type VolumeSlug,
77
} from "@deno/sandbox";
8-
import { green, magenta, red } from "@std/fmt/colors";
8+
import { green, magenta, red, yellow } from "@std/fmt/colors";
99
import { pooledMap } from "@std/async";
1010
import { expandGlob } from "@std/fs";
1111
import { join } from "@std/path";
@@ -19,6 +19,7 @@ import {
1919
} from "../util.ts";
2020
import { createTrpcClient, getAuth, tokenStorage } from "../auth.ts";
2121
import { createSwitchCommand, type GlobalContext } from "../main.ts";
22+
import { VERSION } from "../version.ts";
2223

2324
import { volumesCommand } from "./volumes.ts";
2425
import { snapshotsCommand } from "./snapshot.ts";
@@ -588,6 +589,7 @@ Example:
588589

589590
export const sandboxCommand = new Command<GlobalContext>()
590591
.name("deno sandbox")
592+
.version(VERSION)
591593
.description("Interact with sandboxes")
592594
.globalOption("--endpoint <endpoint:string>", "the endpoint", {
593595
default: "https://console.deno.com",
@@ -615,6 +617,14 @@ export const sandboxCommand = new Command<GlobalContext>()
615617
if (tokenEnv) {
616618
tokenStorage.set(tokenEnv, true);
617619
}
620+
621+
if (options.debug) {
622+
console.error(
623+
yellow(
624+
`Debug mode is enabled (deno ${Deno.version.deno}, @deno/deploy ${VERSION}, endpoint=${options.endpoint})`,
625+
),
626+
);
627+
}
618628
})
619629
.action(() => {
620630
sandboxCommand.showHelp();

version.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import denoJson from "./deno.json" with { type: "json" };
2+
3+
export const VERSION = (denoJson as { version?: string }).version ??
4+
"0.0.0-dev";

0 commit comments

Comments
 (0)