Improve argument parser user experience
See https://github.com/probonopd/linuxdeployqt/issues/256#issuecomment-373916136 The argument parser requires flags expecting a payload to be passed in the form -arg=payload. If not, it fails to recognize them and falsely reports "argument must not start with --". These usability issues should be gone with these two minor changes.
This commit is contained in:
@@ -416,11 +416,11 @@ int main(int argc, char **argv)
|
|||||||
LogDebug() << "Argument found:" << argument;
|
LogDebug() << "Argument found:" << argument;
|
||||||
int index = argument.indexOf("=");
|
int index = argument.indexOf("=");
|
||||||
extraQtPlugins = QString(argument.mid(index + 1)).split(",");
|
extraQtPlugins = QString(argument.mid(index + 1)).split(",");
|
||||||
} else if (argument.startsWith("-")) {
|
} else if (argument.startsWith("--")) {
|
||||||
LogError() << "Error: arguments must not start with --, only -" << "\n";
|
LogError() << "Error: arguments must not start with --, only -:" << argument << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
LogError() << "Unknown argument" << argument << "\n";
|
LogError() << "Unknown argument:" << argument << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user