Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Molkentin <danimo@owncloud.com>2014-09-17 02:12:16 +0400
committerDaniel Molkentin <danimo@owncloud.com>2014-09-17 02:12:16 +0400
commit5406407ed61b24139a4fa94fc8a96a21650d9f51 (patch)
tree6c1015e5ace6f7a19adbdcc05fb605b4a564204c /src/owncloudcmd
parentb72cee2783efb638416268bdc9c7bfb7afd52eee (diff)
Implement --non-interactive as per Juergens' request
Diffstat (limited to 'src/owncloudcmd')
-rw-r--r--src/owncloudcmd/owncloudcmd.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/owncloudcmd/owncloudcmd.cpp b/src/owncloudcmd/owncloudcmd.cpp
index a7c649abe..3a1525f07 100644
--- a/src/owncloudcmd/owncloudcmd.cpp
+++ b/src/owncloudcmd/owncloudcmd.cpp
@@ -51,6 +51,7 @@ struct CmdOptions {
bool silent;
bool trustSSL;
bool useNetrc;
+ bool interactive;
QString exclude;
};
@@ -130,6 +131,7 @@ void help()
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 << "" << std::endl;
exit(1);
@@ -176,6 +178,8 @@ void parseOptions( const QStringList& app_args, CmdOptions *options )
options->trustSSL = true;
} else if( option == "-n") {
options->useNetrc = true;
+ } else if( option == "--non-interactive") {
+ options->interactive = false;
} else if( (option == "-u" || option == "--user") && !it.peekNext().startsWith("-") ) {
options->user = it.next();
} else if( (option == "-p" || option == "--password") && !it.peekNext().startsWith("-") ) {
@@ -199,6 +203,7 @@ int main(int argc, char **argv) {
options.silent = false;
options.trustSSL = false;
options.useNetrc = false;
+ options.interactive = true;
ClientProxy clientProxy;
parseOptions( app.arguments(), &options );
@@ -228,14 +233,16 @@ int main(int argc, char **argv) {
password = url.password();
}
- if (user.isEmpty()) {
- std::cout << "Please enter user name: ";
- std::string s;
- std::getline(std::cin, s);
- user = QString::fromStdString(s);
- }
- if (password.isEmpty()) {
- password = queryPassword(user);
+ if (options.interactive) {
+ if (user.isEmpty()) {
+ std::cout << "Please enter user name: ";
+ std::string s;
+ std::getline(std::cin, s);
+ user = QString::fromStdString(s);
+ }
+ if (password.isEmpty()) {
+ password = queryPassword(user);
+ }
}
}