Skip to content

Commit 82b5ede

Browse files
committed
ignore prompt when using cronjob
1 parent 67404c0 commit 82b5ede

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

config.example.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ render:
1717
full: dddd, MMMM Do, YYYY HH:mm:ss ZZ
1818
short: MMMM Do, YYYY
1919
compact: YYYY-M-D HH:mm:ss
20+
# prompt confirmation to remove old data.
21+
# Set to false if you are using cronjob,
22+
# true when you run it manually.
23+
# data directory will be cleared when manipulating new data.
24+
confirm-clear-data: false
2025

2126
api:
2227
ratelimit: 2 # set to 1 request per sec as per mojang api rate limit

index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@ logger.Default.info('CREATE OUTPUT DIR', output);
3737

3838

3939
(async () => {
40-
const prompt = await confirm('Do you want to clean the output folder?');
41-
if (prompt) {
42-
try {
43-
fs.emptyDirSync(output);
44-
} catch (err) {
45-
throw new Error(err);
40+
if (config.render['confirm-clear-data']) {
41+
const prompt = await confirm('Do you want to clean the output folder?');
42+
if (prompt) {
43+
try {
44+
fs.emptyDirSync(output);
45+
} catch (err) {
46+
throw new Error(err);
47+
}
4648
}
4749
}
4850

0 commit comments

Comments
 (0)