fix(command options): allow to use camelCase for options. (#3787)

Previously this resulted in weird behaviour, now we automatically add an alias for the camelize version of the flag name.

Fixes #3625.
This commit is contained in:
Hans 2017-02-07 11:11:35 -08:00 committed by GitHub
parent d8f36dfc87
commit 496e13af08
2 changed files with 3 additions and 0 deletions

View File

@ -183,6 +183,7 @@ Command.prototype.mergeDuplicateOption = function(key) {
*/
Command.prototype.normalizeOption = function(option) {
option.key = camelize(option.name);
option.aliases = (option.aliases || []).concat(camelize(option.name));
option.required = option.required || false;
return option;
};

View File

@ -22,6 +22,8 @@ export default function() {
'<h1 i18n="An introduction header for this sample">Hello i18n!</h1>'))
.then(() => ng('build', '--aot', '--i18n-file', 'src/locale/messages.fr.xlf', '--i18n-format',
'xlf', '--locale', 'fr'))
.then(() => ng('build', '--aot', '--i18nFile', 'src/locale/messages.fr.xlf', '--i18nFormat',
'xlf', '--locale', 'fr'))
.then(() => expectFileToMatch('dist/main.bundle.js', /Bonjour i18n!/))
.then(() => ng('build', '--aot'))
.then(() => expectToFail(() => expectFileToMatch('dist/main.bundle.js', /Bonjour i18n!/)))