Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/cmd/cmd.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/*
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2014 ownCloud GmbH
* SPDX-License-Identifier: GPL-2.0-or-later
*/

#include <cstdlib>
#include <iostream>
#include <qcoreapplication.h>

Check failure on line 9 in src/cmd/cmd.cpp

View workflow job for this annotation

GitHub Actions / build

src/cmd/cmd.cpp:9:10 [clang-diagnostic-error]

'qcoreapplication.h' file not found
#include <QStringList>
#include <QUrl>
#include <QFile>
Expand Down Expand Up @@ -174,7 +175,7 @@
std::cout << " --user, -u [name] Use [name] as the login name" << std::endl;
std::cout << " --password, -p [pass] Use [pass] as password" << std::endl;
std::cout << " -n Use netrc (5) for login" << std::endl;
std::cout << " --non-interactive Do not block execution with interaction" << std::endl;
std::cout << " --non-interactive Do not block execution with interaction and tries to read $NC_USER and $NC_PASSWORD if not set by other means" << std::endl;
Comment thread
camilasan marked this conversation as resolved.
std::cout << " --max-sync-retries [n] Retries maximum n times (default to 3)" << std::endl;
std::cout << " --uplimit [n] Limit the upload speed of files to n KB/s" << std::endl;
std::cout << " --downlimit [n] Limit the download speed of files to n KB/s" << std::endl;
Expand Down Expand Up @@ -296,7 +297,7 @@
}
}

int main(int argc, char **argv)

Check warning on line 300 in src/cmd/cmd.cpp

View workflow job for this annotation

GitHub Actions / build

src/cmd/cmd.cpp:300:5 [readability-function-cognitive-complexity]

function 'main' has cognitive complexity of 40 (threshold 25)
{
#ifdef Q_OS_WIN
SetDllDirectory(L"");
Expand Down Expand Up @@ -351,6 +352,7 @@
// 2. From options
// 3. From netrc (if enabled)
// 4. From prompt (if interactive)
// 5. From environment (if non-interactive)

QString user = hostUrl.userName();
QString password = hostUrl.password();
Expand Down Expand Up @@ -382,7 +384,15 @@
if (password.isEmpty()) {
password = queryPassword(user);
}
} else {
if (user.isEmpty()) {
user = QString::fromUtf8(qgetenv("NC_USER"));
}
if (password.isEmpty()) {
password = QString::fromUtf8(qgetenv("NC_PASSWORD"));
}
}


// Find the folder and the original owncloud url

Expand Down
Loading