From: AJ ONeal Date: Tue, 16 Jun 2020 12:25:07 +0000 (-0600) Subject: add --debug option to _webi/test.js X-Git-Url: https://git.josue.xyz/?a=commitdiff_plain;h=7e267316c05b496ea409c0eedb429ffcf2317b4f;p=webi-installers%2F.git add --debug option to _webi/test.js --- diff --git a/_webi/test.js b/_webi/test.js index 552a5fa..e40495e 100755 --- a/_webi/test.js +++ b/_webi/test.js @@ -4,10 +4,18 @@ // Print help if there's no pkgdir argument // var usage = [ - 'Usage: node _webi/test.js ', - 'Example: node _webi/test.js ./node/' + 'Usage: node _webi/test.js --debug ', + 'Example: node _webi/test.js --debug ./node/' ].join('\n'); +var count = 3; +var debug = false; + +if (/\b-?-debug?\b/.test(process.argv.join(' '))) { + count += 1; + debug = true; +} + if (3 !== process.argv.length) { console.error(usage); process.exit(1); @@ -97,7 +105,9 @@ Releases.get(path.join(process.cwd(), pkgdir)).then(function (all) { var bashFile = 'install-' + pkgname + '.sh'; var batFile = 'install-' + pkgname + '.bat'; - bashTxt = bashTxt.replace(/#set -x/g, 'set -x'); + if (debug) { + bashTxt = bashTxt.replace(/#set -x/g, 'set -x'); + } fs.writeFileSync(bashFile, bashTxt, 'utf-8'); console.info('Has the necessary files?'); console.info('\tNEEDS MANUAL TEST: %s', bashFile);