From 7e267316c05b496ea409c0eedb429ffcf2317b4f Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 16 Jun 2020 06:25:07 -0600 Subject: [PATCH] add --debug option to _webi/test.js --- _webi/test.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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); -- 2.25.1