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

Method _checkForConflictingLocalOptions

lib/command.js:1706–1727  ·  view source on GitHub ↗

* Display an error message if conflicting options are used together in this. * * @private

()

Source from the content-addressed store, hash-verified

1704 * @private
1705 */
1706 _checkForConflictingLocalOptions() {
1707 const definedNonDefaultOptions = this.options.filter((option) => {
1708 const optionKey = option.attributeName();
1709 if (this.getOptionValue(optionKey) === undefined) {
1710 return false;
1711 }
1712 return this.getOptionValueSource(optionKey) !== 'default';
1713 });
1714
1715 const optionsWithConflicting = definedNonDefaultOptions.filter(
1716 (option) => option.conflictsWith.length > 0,
1717 );
1718
1719 optionsWithConflicting.forEach((option) => {
1720 const conflictingAndDefined = definedNonDefaultOptions.find((defined) =>
1721 option.conflictsWith.includes(defined.attributeName()),
1722 );
1723 if (conflictingAndDefined) {
1724 this._conflictingOption(option, conflictingAndDefined);
1725 }
1726 });
1727 }
1728
1729 /**
1730 * Display an error message if conflicting options are used together.

Callers 1

Calls 4

getOptionValueMethod · 0.95
getOptionValueSourceMethod · 0.95
_conflictingOptionMethod · 0.95
attributeNameMethod · 0.80

Tested by

no test coverage detected