owncloudcmd: Implement --version, fix strings

Part of #2211
This commit is contained in:
Daniel Molkentin 2014-10-10 15:38:56 +02:00
parent d880f2ffbc
commit c4f96c2fba
2 changed files with 21 additions and 6 deletions

View file

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

View file

@ -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):