Skip to content

🎥 Make videos programmatically with React

`@remotion/lambda`: Don't quit on first no on `rmall`

Jonny Burger4f212b6041f1
diff --git a/packages/lambda/src/cli/commands/functions/rm.ts b/packages/lambda/src/cli/commands/functions/rm.ts
index d2b5ad2a2f..901f5c286c 100644
--- a/packages/lambda/src/cli/commands/functions/rm.ts
+++ b/packages/lambda/src/cli/commands/functions/rm.ts
@@ -56,7 +56,12 @@ export const functionsRmCommand = async (args: string[]) => {
true
);
- await confirmCli({delMessage: 'Delete? (Y/n)', allowForceFlag: true});
+ if (
+ !(await confirmCli({delMessage: 'Delete? (Y/n)', allowForceFlag: true}))
+ ) {
+ quit(1);
+ }
+
const output = CliInternals.createOverwriteableCliOutput({
quiet: CliInternals.quietFlagProvided(),
cancelSignal: null,
diff --git a/packages/lambda/src/cli/commands/functions/rmall.ts b/packages/lambda/src/cli/commands/functions/rmall.ts
index 1184303031..a428a5000c 100644
--- a/packages/lambda/src/cli/commands/functions/rmall.ts
+++ b/packages/lambda/src/cli/commands/functions/rmall.ts
@@ -40,7 +40,12 @@ export const functionsRmallCommand = async () => {
true
);
- await confirmCli({delMessage: 'Delete? (Y/n)', allowForceFlag: true});
+ if (
+ !(await confirmCli({delMessage: 'Delete? (Y/n)', allowForceFlag: true}))
+ ) {
+ continue;
+ }
+
const output = CliInternals.createOverwriteableCliOutput({
quiet: CliInternals.quietFlagProvided(),
cancelSignal: null,
diff --git a/packages/lambda/src/cli/commands/quotas/increase.ts b/packages/lambda/src/cli/commands/quotas/increase.ts
index df17c04e9d..1aef51f139 100644
--- a/packages/lambda/src/cli/commands/quotas/increase.ts
+++ b/packages/lambda/src/cli/commands/quotas/increase.ts
@@ -84,10 +84,15 @@ export const quotasIncreaseCommand = async () => {
Log.info(
`Sending request to AWS to increase concurrency limit from ${concurrencyCurrent} to ${newLimit}.`
);
- await confirmCli({
- allowForceFlag: true,
- delMessage: 'Send? (Y/n)',
- });
+ if (
+ !(await confirmCli({
+ allowForceFlag: true,
+ delMessage: 'Send? (Y/n)',
+ }))
+ ) {
+ quit(1);
+ }
+
try {
await getServiceQuotasClient(region).send(
new RequestServiceQuotaIncreaseCommand({
diff --git a/packages/lambda/src/cli/commands/sites/rm.ts b/packages/lambda/src/cli/commands/sites/rm.ts
index 360edfef95..f91733fadc 100644
--- a/packages/lambda/src/cli/commands/sites/rm.ts
+++ b/packages/lambda/src/cli/commands/sites/rm.ts
@@ -41,12 +41,16 @@ export const sitesRmSubcommand = async (args: string[]) => {
return quit(1);
}
- await confirmCli({
- delMessage: `Site ${site.id} in bucket ${
- site.bucketName
- } (${CliInternals.formatBytes(site.sizeInBytes)}): Delete? (Y/n)`,
- allowForceFlag: true,
- });
+ if (
+ !(await confirmCli({
+ delMessage: `Site ${site.id} in bucket ${
+ site.bucketName
+ } (${CliInternals.formatBytes(site.sizeInBytes)}): Delete? (Y/n)`,
+ allowForceFlag: true,
+ }))
+ ) {
+ quit(1);
+ }
const {totalSizeInBytes: totalSize} = await deleteSite({
bucketName,
diff --git a/packages/lambda/src/cli/commands/sites/rmall.ts b/packages/lambda/src/cli/commands/sites/rmall.ts
index b745ec4469..2328d5a1b2 100644
--- a/packages/lambda/src/cli/commands/sites/rmall.ts
+++ b/packages/lambda/src/cli/commands/sites/rmall.ts
@@ -20,12 +20,16 @@ export const sitesRmallSubcommand = async () => {
(await getOrCreateBucket({region})).bucketName;
for (const site of deployedSites.sites) {
- await confirmCli({
- delMessage: `Site ${site.id} in bucket ${
- site.bucketName
- } (${CliInternals.formatBytes(site.sizeInBytes)}): Delete? (Y/n)`,
- allowForceFlag: true,
- });
+ if (
+ !(await confirmCli({
+ delMessage: `Site ${site.id} in bucket ${
+ site.bucketName
+ } (${CliInternals.formatBytes(site.sizeInBytes)}): Delete? (Y/n)`,
+ allowForceFlag: true,
+ }))
+ ) {
+ continue;
+ }
const {totalSizeInBytes: totalSize} = await deleteSite({
bucketName,
diff --git a/packages/lambda/src/cli/helpers/confirm.ts b/packages/lambda/src/cli/helpers/confirm.ts
index 6944ecad39..4b840194c8 100644
--- a/packages/lambda/src/cli/helpers/confirm.ts
+++ b/packages/lambda/src/cli/helpers/confirm.ts
@@ -1,5 +1,4 @@
import {forceFlagProvided} from '../args';
-import {quit} from './quit';
import {yesOrNo} from './yes-or-no';
export const confirmCli = async ({
@@ -15,7 +14,5 @@ export const confirmCli = async ({
const result = await yesOrNo({question: delMessage, defaultValue: true});
- if (result === false) {
- quit(1);
- }
+ return result;
};