|
1 | 1 | #!/usr/bin/env node |
2 | | -const VERSION = '1.1.0' |
| 2 | +const VERSION = '1.1.1' |
3 | 3 |
|
4 | 4 | const getPackFormat = require('./index.js') |
5 | 5 |
|
6 | 6 | const arg = n => process.argv[n + 1] |
7 | 7 |
|
8 | 8 | if (arg(1) && !arg(1).includes('h')) |
9 | | - if (arg(1).includes('v')) |
| 9 | + if (/v/.test(arg(1))) |
10 | 10 | console.log(`The current version of pack-format is ${VERSION}`) |
11 | | - else if (arg(1).includes('d')) |
| 11 | + else if (/^-*d/.test(arg(1))) |
12 | 12 | console.log(`Data pack format of ${arg(2)} is ${getPackFormat(arg(2), 'data')}`) |
13 | | - else if (arg(1).includes('r')) |
| 13 | + else if (/^-*r/.test(arg(1))) |
14 | 14 | console.log(`Resource pack format of ${arg(2)} is ${getPackFormat(arg(2), 'resource')}`) |
15 | 15 | else |
16 | 16 | console.log(`Pack format of ${arg(1)} is ${getPackFormat(arg(1))}`) |
17 | 17 | else { |
| 18 | + const indent = n => ' '.repeat(n * 4) |
18 | 19 | const log = (arg, desc) => { |
19 | | - console.log(`\n\tpack-format ${arg}`) |
20 | | - for (text of desc) console.log('\t ' + text) |
| 20 | + console.log(`\n${indent(2)}pack-format ${arg}`) |
| 21 | + for (text of desc) console.log(indent(3) + text) |
21 | 22 | } |
22 | | - console.log(`\npack-format arguments:\n`) |
23 | | - log('<version>', ['Retrieve the pack format of any Minecraft version.', ' Defaults to resource pack format when applicable.']) |
| 23 | + console.log(`\n${indent(1)}pack-format arguments:`) |
| 24 | + log('<version>', ['Retrieve the pack format of any Minecraft version.', indent(1) + 'Defaults to resource pack format when applicable.']) |
24 | 25 | log('(--data|-d) <version>', ['Retrieve the data pack format in particular when applicable.']) |
25 | 26 | log('(--resource|-r) <version>', ['Retrieve the resource pack format in particular when applicable.']) |
26 | 27 | } |
|
0 commit comments