aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-04-19 18:55:07 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-04-19 18:55:07 +0200
commit9d53702202c74de8d9dc5794312c8f20d2232312 (patch)
tree65395897bd459d8db5dc68c15f1e25736ea50326
parentAdd Window menu (diff)
downloadsmolbote-9d53702202c74de8d9dc5794312c8f20d2232312.tar.xz
Update CommandLine help
-rw-r--r--src/commandline.cpp37
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;