MCPcopy
hub / github.com/tj/commander.js / _checkForMissingMandatoryOptions

Method _checkForMissingMandatoryOptions

lib/command.js:1687–1699  ·  view source on GitHub ↗

* Display an error message if a mandatory option does not have a value. * Called after checking for help flags in leaf subcommand. * * @private

()

Source from the content-addressed store, hash-verified

1685 */
1686
1687 _checkForMissingMandatoryOptions() {
1688 // Walk up hierarchy so can call in subcommand after checking for displaying help.
1689 this._getCommandAndAncestors().forEach((cmd) => {
1690 cmd.options.forEach((anOption) => {
1691 if (
1692 anOption.mandatory &&
1693 cmd.getOptionValue(anOption.attributeName()) === undefined
1694 ) {
1695 cmd.missingMandatoryOptionValue(anOption);
1696 }
1697 });
1698 });
1699 }
1700
1701 /**
1702 * Display an error message if conflicting options are used together in this.

Callers 2

_executeSubCommandMethod · 0.95
_parseCommandMethod · 0.95

Calls 4

getOptionValueMethod · 0.80
attributeNameMethod · 0.80

Tested by

no test coverage detected