diff --git a/index.js b/index.js index fb648beec..19f645640 100644 --- a/index.js +++ b/index.js @@ -787,6 +787,7 @@ Command.prototype.opts = function() { Command.prototype.missingArgument = function(name) { console.error(); console.error(" error: missing required argument `%s'", name); + console.error(" Try '--help' for more information."); console.error(); process.exit(1); }; @@ -806,6 +807,7 @@ Command.prototype.optionMissingArgument = function(option, flag) { } else { console.error(" error: option `%s' argument missing", option.flags); } + console.error(" Try '--help' for more information."); console.error(); process.exit(1); }; @@ -821,6 +823,7 @@ Command.prototype.unknownOption = function(flag) { if (this._allowUnknownOption) return; console.error(); console.error(" error: unknown option `%s'", flag); + console.error(" Try '--help' for more information."); console.error(); process.exit(1); }; @@ -835,6 +838,7 @@ Command.prototype.unknownOption = function(flag) { Command.prototype.variadicArgNotLast = function(name) { console.error(); console.error(" error: variadic arguments must be last `%s'", name); + console.error(" Try '--help' for more information."); console.error(); process.exit(1); }; diff --git a/test/test.command.allowUnknownOption.js b/test/test.command.allowUnknownOption.js index 7261dd95a..e45550631 100644 --- a/test/test.command.allowUnknownOption.js +++ b/test/test.command.allowUnknownOption.js @@ -13,7 +13,7 @@ program .option('-p, --pepper', 'add pepper'); program.parse('node test -m'.split(' ')); -stubError.callCount.should.equal(3); +stubError.callCount.should.equal(4); // test subcommand @@ -24,7 +24,7 @@ program }); program.parse('node test sub -m'.split(' ')); -stubError.callCount.should.equal(3); +stubError.callCount.should.equal(4); stubExit.calledOnce.should.be.true(); // command with `allowUnknownOption` diff --git a/test/test.options.args.required.js b/test/test.options.args.required.js index f809f3f67..b9dfe0b81 100644 --- a/test/test.options.args.required.js +++ b/test/test.options.args.required.js @@ -14,7 +14,7 @@ console.error = function () { process.on('exit', function (code) { code.should.equal(1); - info.length.should.equal(3); + info.length.should.equal(4); info[1].should.equal(" error: option `-c, --cheese ' argument missing"); process.exit(0) }); diff --git a/test/test.variadic.args.js b/test/test.variadic.args.js index 72cff8ae1..ed3837066 100644 --- a/test/test.variadic.args.js +++ b/test/test.variadic.args.js @@ -60,5 +60,6 @@ console.error = oldConsoleError; [ '', ' error: variadic arguments must be last `variadicArg\'', + ' Try \'--help\' for more information.', '' ].join('\n').should.eql(errorMessage);