Skip to content

Commit c489a44

Browse files
authored
Remove confirmation dialog for cloudchamber apply when not interactive (#9664)
Prior to this the dialog was getting printed but auto-confirmed to yes which is confusing to users.
1 parent caf97e4 commit c489a44

File tree

3 files changed

+18
-30
lines changed

3 files changed

+18
-30
lines changed

.changeset/cuddly-sites-doubt.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"wrangler": patch
3+
---
4+
5+
Remove cloudchamber/container apply confirmation dialog when run non-interactively.

packages/wrangler/src/__tests__/cloudchamber/apply.test.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,6 @@ describe("cloudchamber apply", () => {
135135
│ [containers.constraints]
136136
│ tier = 2
137137
138-
├ Do you want to apply these changes?
139-
│ yes
140-
141138
142139
│  SUCCESS  Created application my-container-app (Application ID: abc)
143140
@@ -197,9 +194,6 @@ describe("cloudchamber apply", () => {
197194
│ - tier = 3
198195
│ + tier = 2
199196
200-
├ Do you want to apply these changes?
201-
│ yes
202-
203197
├ Loading
204198
205199
@@ -287,9 +281,6 @@ describe("cloudchamber apply", () => {
287281
│ [containers.constraints]
288282
│ tier = 1
289283
290-
├ Do you want to apply these changes?
291-
│ yes
292-
293284
├ Loading
294285
295286
@@ -374,9 +365,6 @@ describe("cloudchamber apply", () => {
374365
│ [containers.constraints]
375366
│ tier = 1
376367
377-
├ Do you want to apply these changes?
378-
│ yes
379-
380368
381369
│  SUCCESS  Created application my-container-app-2 (Application ID: abc)
382370
@@ -455,9 +443,6 @@ describe("cloudchamber apply", () => {
455443
│ [containers.constraints]
456444
│ tier = 1
457445
458-
├ Do you want to apply these changes?
459-
│ yes
460-
461446
├ Loading
462447
463448
@@ -585,9 +570,6 @@ describe("cloudchamber apply", () => {
585570
│ - [[containers.configuration.secrets]]
586571
│ name = \\"MY_SECRET_2\\"
587572
588-
├ Do you want to apply these changes?
589-
│ yes
590-
591573
├ Loading
592574
593575

packages/wrangler/src/cloudchamber/apply.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -572,19 +572,20 @@ export async function apply(
572572
endSection("No changes to be made");
573573
return;
574574
}
575-
576-
const yes = await processArgument<boolean>(
577-
{ confirm: args.json ? true : undefined },
578-
"confirm",
579-
{
580-
type: "confirm",
581-
question: "Do you want to apply these changes?",
582-
label: "",
575+
if (!args.json) {
576+
const yes = await processArgument<boolean>(
577+
{ confirm: undefined },
578+
"confirm",
579+
{
580+
type: "confirm",
581+
question: "Do you want to apply these changes?",
582+
label: "",
583+
}
584+
);
585+
if (!yes) {
586+
cancel("Not applying changes");
587+
return;
583588
}
584-
);
585-
if (!yes) {
586-
cancel("Not applying changes");
587-
return;
588589
}
589590

590591
function formatError(err: ApiError): string {

0 commit comments

Comments
 (0)