Validates alias value @method validateAlias @param {Object} alias @return {Boolean}
(option, alias)
| 512 | @return {Boolean} |
| 513 | */ |
| 514 | validateAlias(option, alias) { |
| 515 | let key = alias.key; |
| 516 | let value = alias.value; |
| 517 | |
| 518 | if (!this.optionsAliases[key]) { |
| 519 | return true; |
| 520 | } else { |
| 521 | if (value[0] !== this.optionsAliases[key][0]) { |
| 522 | throw new SilentError( |
| 523 | `The "${key}" alias is already in use by the "${this.optionsAliases[key][0]}" option ` + |
| 524 | `and cannot be used by the "${value[0]}" option. Please use a different alias.` |
| 525 | ); |
| 526 | } else if (value[1] !== this.optionsAliases[key][1]) { |
| 527 | this.ui.writeLine(chalk.yellow(`The "${key}" alias cannot be overridden. Please use a different alias.`)); |
| 528 | // delete offending alias from options |
| 529 | let index = this.availableOptions.indexOf(option); |
| 530 | let aliasIndex = this.availableOptions[index].aliases.indexOf(alias.original); |
| 531 | if (this.availableOptions[index].aliases[aliasIndex]) { |
| 532 | // first one wins |
| 533 | this.availableOptions[index].aliases = [this.availableOptions[index].aliases[0]]; |
| 534 | } |
| 535 | } |
| 536 | return false; |
| 537 | } |
| 538 | }, |
| 539 | |
| 540 | /** |
| 541 | Parses command arguments and processes |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…