qdbusxml2cpp: Fail if -c option is used with multiple interfaces
Exit with an error code when -c option is specified by the command is not processing a single interface. Mention this in the option description. Fixes: QTBUG-36405 Change-Id: I7ea217c780d37332278c634f030d20040b7459e6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
6f6bd2c4dc
commit
1ee7aa741a
@ -1087,7 +1087,9 @@ int main(int argc, char **argv)
|
||||
parser.addOption(adapterCodeOption);
|
||||
|
||||
QCommandLineOption classNameOption(QStringList{u"c"_s, u"classname"_s},
|
||||
u"Use <classname> as the class name for the generated classes"_s, u"classname"_s);
|
||||
u"Use <classname> as the class name for the generated classes. "
|
||||
u"This option can only be used when processing a single interface."_s,
|
||||
u"classname"_s);
|
||||
parser.addOption(classNameOption);
|
||||
|
||||
QCommandLineOption addIncludeOption(QStringList{u"i"_s, u"include"_s},
|
||||
@ -1147,6 +1149,11 @@ int main(int argc, char **argv)
|
||||
QDBusIntrospection::Interfaces interfaces = readInput();
|
||||
cleanInterfaces(interfaces);
|
||||
|
||||
if (!globalClassName.isEmpty() && interfaces.count() != 1) {
|
||||
qCritical("Option -c/--classname can only be used with a single interface.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
QStringList args = app.arguments();
|
||||
args.removeFirst();
|
||||
commandLine = PROGRAMNAME " "_L1 + args.join(u' ');
|
||||
|
Loading…
Reference in New Issue
Block a user