validateCliOptDefs method
void
validateCliOptDefs()
Checks there is no long option or long sub-option consisting
of short options and short sub-options
Throws an exception when such match found
Useful solely for the unit testing or a rare sanity check, as
in release mode, the parser simply prefers long options over
the bundled short ones
Implementation
void validateCliOptDefs(List<String> longNames, List<String> longSubNames,
List<String> shortNames, List<String> shortSubNames) {
final allLongNames = <String>[...longNames, ...longSubNames];
final allShortNames = <String>[...shortNames, ...shortSubNames];
for (final longName in allLongNames) {
var isFound = true;
for (final shortName in longName.split('')) {
if (!allShortNames.contains(shortName)) {
isFound = false;
break;
}
}
if (isFound) {
throw CliOptLongNameAsBundleException(longName);
}
}
}