Comparing version 1.0.4 to 1.1.0
@@ -83,2 +83,9 @@ var Parameter, minimist, settings, state, _; | ||
value = definedOption.getOptionsValue(options); | ||
if ((definedOption.required != null) && (value == null)) { | ||
if (_.isString(definedOption.required)) { | ||
throw new Error(definedOption.required); | ||
} else if (definedOption.required) { | ||
throw new Error("Option " + definedOption.signature + " is required"); | ||
} | ||
} | ||
if (!definedOption.matches(value)) { | ||
@@ -85,0 +92,0 @@ continue; |
{ | ||
"name": "capitano", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"description": "Powerful, non opitionated command line parser for serious applications", | ||
@@ -5,0 +5,0 @@ "main": "build/capitano.js", |
@@ -236,2 +236,6 @@ Capitano | ||
### Option#required (boolean|string) | ||
Defines whether an option is required. If the field is `true`, a generic error is thrown, otherwise you can set a custom error message by setting to a `string`. | ||
Examples | ||
@@ -327,2 +331,6 @@ -------- | ||
### 1.1.0 | ||
- Implement support for required options. | ||
### 1.0.4 | ||
@@ -329,0 +337,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
97425
593
376