From 42b5b76000ee461bd59ec097ca9f0f005ba5865d Mon Sep 17 00:00:00 2001 From: David Glasser Date: Tue, 4 Feb 2014 18:06:22 -0800 Subject: [PATCH] some error-checking for option definitions short options must be short, and you can't use names that mean something already --- tools/main.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/main.js b/tools/main.js index 18159e8ed8..0d9688cd6c 100644 --- a/tools/main.js +++ b/tools/main.js @@ -47,11 +47,15 @@ var Command = function (options) { _.extend(this, options); _.each(this.options, function (value, key) { + if (key === "args" || key === "appDir") + throw new Error(options.name + ": bad option name " + key); if (! _.has(value, 'type')) value.type = String; if (_.has(value, 'default') && _.has(value, 'required')) throw new Error(options.name + ": " + key + " can't be both optional " + "and required"); + if (_.has(value, 'short') && value.short.length !== 1) + throw new Error(options.name + ": " + key + " has a bad short option"); }); };