From b63a64a42465fe677acb510d1cc2bff2afa7c3a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ir=C3=A9n=C3=A9e?= Date: Thu, 30 Oct 2025 09:58:04 +0000 Subject: [PATCH] chore: Add option to reset command to skip the confirmation question (#21369) --- scripts/reset.mjs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/reset.mjs b/scripts/reset.mjs index c3082042f21..6f9266203f7 100644 --- a/scripts/reset.mjs +++ b/scripts/reset.mjs @@ -1,5 +1,5 @@ // Resets the repository by deleting all untracked files except for few exceptions. -import { $, echo, fs } from 'zx'; +import { $, argv, echo, fs } from 'zx'; $.verbose = true; process.env.FORCE_COLOR = '1'; @@ -11,11 +11,15 @@ echo( `This will delete all untracked files except for those matching the following patterns: ${excludePatterns.map((x) => `"${x}"`).join(', ')}.`, ); -const answer = await question('โ“ Do you want to continue? (y/n) '); +const skipConfirmation = argv.force || argv.f; -if (!['y', 'Y', ''].includes(answer)) { - echo('Aborting...'); - process.exit(0); +if (!skipConfirmation) { + const answer = await question('โ“ Do you want to continue? (y/n) '); + + if (!['y', 'Y', ''].includes(answer)) { + echo('Aborting...'); + process.exit(0); + } } echo('๐Ÿงน Cleaning untracked files...');