Skip to content

Commit 0790df6

Browse files
committed
more extensive sandbox CLI
1 parent 7c347df commit 0790df6

5 files changed

Lines changed: 274 additions & 35 deletions

File tree

auth.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,15 @@ export function createTrpcClient(debug: boolean, deployUrl: string) {
6161
links: [
6262
errorLink,
6363
retryLink({
64-
retry() {
64+
retry(opts) {
65+
if (opts.error.data.httpStatus !== 401) {
66+
return false;
67+
}
68+
69+
if (debug) {
70+
console.log(opts);
71+
}
72+
6573
if (tokenIsTemp) {
6674
error(
6775
debug,
@@ -113,7 +121,6 @@ export function createTrpcClient(debug: boolean, deployUrl: string) {
113121
async headers() {
114122
if (retryPromise) {
115123
await retryPromise;
116-
retryPromise = undefined;
117124
}
118125

119126
if (storedAuth) {
@@ -166,7 +173,7 @@ export async function getAuth(
166173
const authUrl = `${deployUrl}/auth?code=${code}`;
167174

168175
const spinner = new Spinner({
169-
message: `Visit ${authUrl} to authorize deploying your project.\x07`,
176+
message: `Visit ${authUrl} to authorize deploying your project.`,
170177
color: "yellow",
171178
});
172179
spinner.start();

create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export async function create(
5050
}
5151

5252
const spinner = new Spinner({
53-
message: `Visit ${url.href} to create a new application.\x07`,
53+
message: `Visit ${url.href} to create a new application.`,
5454
color: "yellow",
5555
});
5656
spinner.start();

deno.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,9 @@
4040
},
4141
"exclude": [
4242
"astro-demo"
43-
]
43+
],
44+
"deploy": {
45+
"org": "crowlkats",
46+
"app": "foo"
47+
}
4448
}

main.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@ import {
1616
} from "./env.ts";
1717
import { createTrpcClient, getAuth } from "./auth.ts";
1818
import token_storage from "./token_storage.ts";
19-
import {
20-
sandboxKillCommand,
21-
sandboxListCommand,
22-
sandboxNewCommand,
23-
sandboxSshCommand,
24-
} from "./sandbox.ts";
19+
import { sandboxCommand } from "./sandbox.ts";
2520

2621
const MINIMUM_DENO_VERSION = "2.4.2";
2722
if (
@@ -184,17 +179,6 @@ const envCommand = new Command<GlobalOptions>()
184179
.command("delete", envDeleteCommand)
185180
.command("load", envLoadCommand);
186181

187-
const sandboxCommand = new Command<GlobalOptions>()
188-
.description("Interact with sandboxes")
189-
.globalOption("--org <name:string>", "The name of the organization")
190-
.action(() => {
191-
sandboxCommand.showHelp();
192-
})
193-
.command("new", sandboxNewCommand)
194-
.command("list", sandboxListCommand)
195-
.command("kill", sandboxKillCommand)
196-
.command("ssh", sandboxSshCommand);
197-
198182
const logsCommand = new Command<GlobalOptions>()
199183
.description("Stream logs from an application")
200184
.option("--org <name:string>", "The name of the organization")

0 commit comments

Comments
 (0)