chore: Add option to reset command to skip the confirmation question (#21369)

This commit is contained in:
Irénée 2025-10-30 09:58:04 +00:00 committed by GitHub
parent 56805ca000
commit b63a64a424
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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...');