Add some error checking to cli --share
This commit is contained in:
parent
1956af935f
commit
cc648ecc77
1 changed files with 6 additions and 4 deletions
|
@ -193,13 +193,15 @@ int main(int argc, char **argv)
|
||||||
if (parser.isSet(QStringLiteral("share"))) {
|
if (parser.isSet(QStringLiteral("share"))) {
|
||||||
QStringList urls;
|
QStringList urls;
|
||||||
|
|
||||||
QUrl url = QUrl::fromUserInput(parser.value(QStringLiteral("share")), QDir::currentPath());
|
QString firstArg = parser.value(QStringLiteral("share"));
|
||||||
urls.append(url.toString());
|
const auto args = QStringList(firstArg) + parser.positionalArguments();
|
||||||
|
|
||||||
// Check for more arguments
|
|
||||||
const auto args = parser.positionalArguments();
|
|
||||||
for (const QString &input : args) {
|
for (const QString &input : args) {
|
||||||
QUrl url = QUrl::fromUserInput(input, QDir::currentPath());
|
QUrl url = QUrl::fromUserInput(input, QDir::currentPath());
|
||||||
|
if (url.isEmpty()) {
|
||||||
|
qWarning() << "URL not valid:" << input;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
urls.append(url.toString());
|
urls.append(url.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue