[Pkg-owncloud-commits] [owncloud-client] 109/219: Implement --non-interactive as per Juergens' request

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 11 14:43:16 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 5406407ed61b24139a4fa94fc8a96a21650d9f51
Author: Daniel Molkentin <danimo at owncloud.com>
Date:   Wed Sep 17 00:12:16 2014 +0200

    Implement --non-interactive as per Juergens' request
---
 src/owncloudcmd/owncloudcmd.cpp | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/owncloudcmd/owncloudcmd.cpp b/src/owncloudcmd/owncloudcmd.cpp
index a7c649a..3a1525f 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);
+            }
         }
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list