From be566999a03fccd470f1df74f9b4e7c8d5472211 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Thu, 9 Apr 2020 18:27:48 +0200 Subject: [PATCH] exit sanely if no args are given I mean some seem to like python style throwing up in ones face on every occasion.. I don't though.. nodes drops the original argv0 in favor of process.execPath and the path to the JavaScript file being executed, so we need more than two args to be OK. Signed-off-by: Thomas Lamprecht --- src/app.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app.js b/src/app.js index dbab0ab..c00079a 100644 --- a/src/app.js +++ b/src/app.js @@ -18,6 +18,10 @@ program.on('--help', function() { console.log(''); }); +if (process.argv.length <= 2) { + program.help(); +} + program.parse(process.argv); let paths = program.args; -- 2.39.2