diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commandline.cpp | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/src/commandline.cpp b/src/commandline.cpp index 6f227c0..bb636f2 100644 --- a/src/commandline.cpp +++ b/src/commandline.cpp @@ -12,12 +12,30 @@ #include <iomanip> #include <iostream> -void printOption(const QCommandLineOption &option) +inline std::string optionText(const QStringList &opts) { - std::cout << "- " - << std::setw(20) << std::left << option.names().join(", ").toStdString() - << std::setw(40) << std::left << option.description().toStdString() - << std::setw(30) << std::left << option.defaultValues().join(", ").toStdString() + std::string r; + for(auto i = opts.constBegin(); i != opts.constEnd(); ) { + if(i->length() == 1) { + r.append("-" + i->toStdString()); + } else { + r.append("--" + i->toStdString()); + } + + ++i; + if(i != opts.constEnd()) { + r.append(", "); + } + } + return r; +} + +inline void printOption(const QCommandLineOption &option) +{ + std::cout << " " + << std::setw(18) << std::left << optionText(option.names()) + << std::setw(32) << std::left << option.description().toStdString() + << std::setw(18) << std::left << option.defaultValues().join(", ").toStdString() << std::endl; } @@ -36,10 +54,10 @@ CommandLine::CommandLine() : QCommandLineParser() , helpOption(addHelpOption()) , versionOption(addVersionOption()) - , buildOption("build", "Show build information.") - , configOption({ "c", "config" }, "Set configuration file.", "path", Configuration::defaultUserConfigLocation()) - , profileOption({ "p", "profile" }, "Use this profile.", "profile", "") - , socketOption("socket", "Local server socket", "name", socketPath()) + , buildOption("build", "Displays build information.") + , configOption({ "c", "config" }, "Sets configuration file.", "path", Configuration::defaultUserConfigLocation()) + , profileOption({ "p", "profile" }, "Sets default profile.", "profile", "") + , socketOption("socket", "Sets local socket.", "name", socketPath()) , newWindowOption("in-new-window", "Open URL in new window") { setApplicationDescription("yet another no-frills browser"); @@ -103,6 +121,7 @@ void CommandLine::printHelp(int exitCode) std::cout << "You can also overwrite configuration options using the syntax: " << std::endl << "--browser.setting.path=value" << std::endl + << "More information on available keys can be found on the manual page." << std::endl << std::endl; std::cout << "Arguments: " << std::endl; |