From 8b5221e13a9763ab1e86033f6e840893e5250077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 3 May 2018 10:45:54 +0300 Subject: [PATCH] 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. --- maxctrl/lib/core.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/maxctrl/lib/core.js b/maxctrl/lib/core.js index 74868a16f..8d7dd6c40 100644 --- a/maxctrl/lib/core.js +++ b/maxctrl/lib/core.js @@ -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.') }) })