[Pkg-owncloud-commits] [owncloud-client] 40/211: owncloudcmd: Implement --version, fix strings

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 25 09:10:24 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 c4f96c2fba3c28b356c1bf9e1e2a9c4f6dab4ee8
Author: Daniel Molkentin <danimo at owncloud.com>
Date:   Fri Oct 10 15:38:56 2014 +0200

    owncloudcmd: Implement --version, fix strings
    
    Part of #2211
---
 src/mirall/owncloudtheme.cpp    |  2 +-
 src/owncloudcmd/owncloudcmd.cpp | 25 ++++++++++++++++++++-----
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/src/mirall/owncloudtheme.cpp b/src/mirall/owncloudtheme.cpp
index a773518..f400bf6 100644
--- a/src/mirall/owncloudtheme.cpp
+++ b/src/mirall/owncloudtheme.cpp
@@ -52,7 +52,7 @@ QString ownCloudTheme::about() const
                "<p>Copyright ownCloud, Inc.</p>"
                "<p>Licensed under the GNU General Public License (GPL) Version 2.0<br/>"
                "ownCloud and the ownCloud Logo are registered trademarks of ownCloud, "
-               "Inc. in the United States, other countries, or both</p>"
+               "Inc. in the United States, other countries, or both.</p>"
                )
             .arg(MIRALL_VERSION_STRING)
             .arg("http://" MIRALL_STRINGIFY(APPLICATION_DOMAIN))
diff --git a/src/owncloudcmd/owncloudcmd.cpp b/src/owncloudcmd/owncloudcmd.cpp
index c9173ba..ca94838 100644
--- a/src/owncloudcmd/owncloudcmd.cpp
+++ b/src/owncloudcmd/owncloudcmd.cpp
@@ -30,9 +30,12 @@
 #include "creds/httpcredentials.h"
 #include "owncloudcmd.h"
 #include "simplesslerrorhandler.h"
-
+#include "theme.h"
 #include "netrcparser.h"
 
+#include "version.h"
+#include "config.h"
+
 #ifdef Q_OS_WIN32
 #include <windows.h>
 #else
@@ -115,9 +118,11 @@ public:
 
 void help()
 {
-    std::cout << "owncloudcmd - command line ownCloud client tool." << std::endl;
+    const char *binaryName = APPLICATION_EXECUTABLE "cmd";
+
+    std::cout << binaryName << " - command line " APPLICATION_NAME " client tool" << std::endl;
     std::cout << "" << std::endl;
-    std::cout << "Usage: owncloudcmd <sourcedir> <owncloudurl>" << std::endl;
+    std::cout << "Usage: " << binaryName << " <sourcedir> <owncloudurl>" << std::endl;
     std::cout << "" << std::endl;
     std::cout << "A proxy can either be set manually using --httpproxy or it" << std::endl;
     std::cout << "uses the setting from a configured sync client." << std::endl;
@@ -127,21 +132,32 @@ void help()
     std::cout << "  --httpproxy [proxy]    Specify a http proxy to use." << std::endl;
     std::cout << "                         Proxy is http://server:port" << std::endl;
     std::cout << "  --trust                Trust the SSL certification." << std::endl;
-    std::cout << "  --exclude [file]       exclude list file" << std::endl;
+    std::cout << "  --exclude [file]       Exclude list file" << std::endl;
     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 << "  --version, -v          Display version and exit" << std::endl;
     std::cout << "" << std::endl;
     exit(1);
 
 }
 
+void showVersion() {
+    const char *binaryName = APPLICATION_EXECUTABLE "cmd";
+    std::cout << binaryName << " version " << qPrintable(Theme::instance()->version()) << std::endl;
+    exit(1);
+}
+
 void parseOptions( const QStringList& app_args, CmdOptions *options )
 {
     QStringList args(app_args);
 
     if( args.count() < 3 ) {
+        const QString option = args.at(1);
+        if (option == "-v" || option == "--version") {
+            showVersion();
+        }
         help();
     }
 
@@ -206,7 +222,6 @@ int main(int argc, char **argv) {
 
     parseOptions( app.arguments(), &options );
 
-
     QUrl url = QUrl::fromUserInput(options.target_url);    
 
     // Order of retrieval attempt (later attempts override earlier ones):

-- 
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