Show help if no command is provided or if command is not found

This commit is contained in:
Adam Wathan 2017-10-20 13:37:29 -04:00
parent 1c15eba932
commit 01f37eb3fe

View File

@ -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)