I have yargs with 2 commands?
yargs
.command('test-all','',handler)
.command('test-file','',handler)
.argv
The user inputs:
node myapp.js other-command
But yargs
don't throw an error. What should I do?
You can use .demandCommand()
to do this:
yargs
.command('test-all','',handler)
.command('test-file','',handler)
.demandCommand(1, 'You need at least one command before moving on')
.argv