diff --git a/lib/command.js b/lib/command.js index d0a4af620..d03e060f8 100644 --- a/lib/command.js +++ b/lib/command.js @@ -580,6 +580,9 @@ Expecting one of '${allowedValues.join("', '")}'`); * @api private */ _optionEx(config, flags, description, fn, defaultValue) { + if (typeof flags === 'object' && flags instanceof Option) { + throw new Error('To add an Option object use addOption() instead of option() or requiredOption()'); + } const option = this.createOption(flags, description); option.makeOptionMandatory(!!config.mandatory); if (typeof fn === 'function') {