forked from kokarn/tarkov-image-generator
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
32 lines (30 loc) · 1.03 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env node
const { generateImages } = require('./generate');
(async () => {
let targetItemId = false;
let forceImage = false;
for (let i = 2; i < process.argv.length; i++) {
const arg = process.argv[i];
if (arg == '-id') {
if (process.argv.length > i+1) {
targetItemId = process.argv[i+1];
}
} else if (arg == '-img' || arg == '-image') {
if (process.argv.length > i+1) {
forceImage = process.argv[i+1];
}
}
}
if (!targetItemId && process.argv[2] && process.argv[2].length == 24) {
targetItemId = process.argv[2];
}
if (!forceImage && process.argv[3] && !isNaN(process.argv[3].length)) {
forceImage = process.argv[3];
}
try {
//await initializeImageGenerator({hashOnly: targetItemId});
await generateImages({targetItemId: targetItemId, forceImageIndex: forceImage});
} catch (error) {
console.log(error);
}
})();