Filename detection should respect short flags (#10763)
* chore: add test files # Conflicts: # packages/babel-node/package.json * fix: respect short flags when finding filename index * fix: use attributeName for kebab-case
This commit is contained in:
@@ -169,15 +169,15 @@ if (program.eval || program.print) {
|
||||
}
|
||||
|
||||
if (arg[0] === "-") {
|
||||
const camelArg = arg
|
||||
.slice(2)
|
||||
.replace(/-(\w)/, (s, c) => c.toUpperCase());
|
||||
const parsedArg = program[camelArg];
|
||||
if (
|
||||
arg === "-r" ||
|
||||
arg === "--require" ||
|
||||
(parsedArg && parsedArg !== true)
|
||||
) {
|
||||
const parsedOption = program.options.find(option => {
|
||||
return option.long === arg || option.short === arg;
|
||||
});
|
||||
if (parsedOption === undefined) {
|
||||
return;
|
||||
}
|
||||
const optionName = parsedOption.attributeName();
|
||||
const parsedArg = program[optionName];
|
||||
if (optionName === "require" || (parsedArg && parsedArg !== true)) {
|
||||
ignoreNext = true;
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user