(optionalShortName, longName, defaultValue)
| 18 | }); |
| 19 | |
| 20 | const addDefaultParamValue = (optionalShortName, longName, defaultValue) => { |
| 21 | let found = false; |
| 22 | for (let i = 0; i < process.argv.length; i++) { |
| 23 | const current = process.argv[i]; |
| 24 | if (current === optionalShortName || current.startsWith(`${longName}=`)) { |
| 25 | found = true; |
| 26 | break; |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | if (!found) { |
| 31 | process.argv.push(`${longName}=${defaultValue}`); |
| 32 | } |
| 33 | }; |
| 34 | |
| 35 | const confirm = async message => { |
| 36 | const confirmation = await prompt(theme`\n{caution ${message}} (y/N) `); |