Fix error message when no command is given

The error message when no commad was given referred to the unknown command
[""]. Due to the way the command was printed, it was quite confusing.
This commit is contained in:
Markus Mäkelä 2018-05-03 10:45:54 +03:00
parent 42c468ff16
commit 8b5221e13a
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -105,7 +105,8 @@ program
.demandCommand(1, 'At least one command is required')
.command('*', 'the default command', {}, function(argv) {
maxctrl(argv, function() {
return error('Unknown command ' + JSON.stringify(argv._) + '. See output of `help` for a list of commands.')
msg = argv._.length == 0 ? 'No command given' : 'Unknown command ' + JSON.stringify(argv._)
return error(msg + '. See output of `help` for a list of commands.')
})
})