From 01f37eb3fe0225abc9bbedcafa8ba9e4624e5d74 Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Fri, 20 Oct 2017 13:37:29 -0400 Subject: [PATCH] Show help if no command is provided or if command is not found --- src/cli.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cli.js b/src/cli.js index 6f24c4cdd..2df7a10aa 100755 --- a/src/cli.js +++ b/src/cli.js @@ -70,8 +70,12 @@ program.command('build') buildTailwind(inputFile, loadConfig(program.config), writeStrategy(program)) }) -program.parse(process.argv) +const subCmd = _.head(program.args); +const cmds = _.map(program.commands, '_name'); -if (! process.argv.slice(2).length) { +if (!_.includes(cmds, subCmd)) { program.help(); + process.exit() } + +program.parse(process.argv)