Merge #13872: [docs] Reformat -help output for help2man

7272fdcfe7370412b34a96bc19f3819e03169ef7 [docs] Reformat -help output for help2man (Tim Ruffing)

Pull request description:

  This commit slightly changes the format of the "Usage" strings in CLI
  `-help` messages to meet the expection of the help2man tool, which we
  use to generate man pages. On the way, we remove a few calls to
  `strprintf()`, which became superficial after commit 32fbfda.

  Before:
  ![screenshot from 2018-08-04 12-11-25](https://user-images.githubusercontent.com/1071625/43675564-6e2e016c-97e2-11e8-8de7-0912a4088efd.png)
  After:
  ![screenshot from 2018-08-04 12-11-46](https://user-images.githubusercontent.com/1071625/43675566-712d7032-97e2-11e8-85a7-5decc6dcb4b2.png)

Tree-SHA512: 9752ee0d0fde0b084e00232609866291ff493f4feb45919279b0f142b04635c049ddd2bf71ff6ad57d4ae1ed37103348640d253bb4f0b3e16b7fd2bb4b2a6fba
This commit is contained in:
Wladimir J. van der Laan 2018-08-07 10:19:09 +02:00 committed by UdjinM6
parent 06d9afa13d
commit 3c28aeefd8
No known key found for this signature in database
GPG Key ID: 83592BD1400D58D9
4 changed files with 14 additions and 19 deletions

View File

@ -115,14 +115,13 @@ static int AppInitRPC(int argc, char* argv[])
}
if (argc < 2 || HelpRequested(gArgs) || gArgs.IsArgSet("-version")) {
std::string strUsage = strprintf("%s RPC client version", PACKAGE_NAME) + " " + FormatFullVersion() + "\n";
std::string strUsage = PACKAGE_NAME " RPC client version " + FormatFullVersion() + "\n";
if (!gArgs.IsArgSet("-version")) {
strUsage += "\nUsage:\n"
" dash-cli [options] <command> [params] " + strprintf("Send command to %s", PACKAGE_NAME) + "\n" +
" dash-cli [options] -named <command> [name=value] ... " + strprintf("Send command to %s (with named arguments)", PACKAGE_NAME) + "\n" +
" dash-cli [options] help List commands\n" +
" dash-cli [options] help <command> Get help for a command\n";
strUsage += "\n"
"Usage: dash-cli [options] <command> [params] Send command to " PACKAGE_NAME "\n"
"or: dash-cli [options] -named <command> [name=value]... Send command to " PACKAGE_NAME " (with named arguments)\n"
"or: dash-cli [options] help List commands\n"
"or: dash-cli [options] help <command> Get help for a command\n";
strUsage += "\n" + gArgs.GetHelpMessage();
}

View File

@ -102,10 +102,9 @@ static int AppInitRawTx(int argc, char* argv[])
if (argc < 2 || HelpRequested(gArgs)) {
// First part of help message is specific to this utility
std::string strUsage = strprintf("%s dash-tx utility version", PACKAGE_NAME) + " " + FormatFullVersion() + "\n\n" +
"Usage:\n"
" dash-tx [options] <hex-tx> [commands] Update hex-encoded dash transaction\n" +
" dash-tx [options] -create [commands] Create hex-encoded dash transaction\n" +
std::string strUsage = PACKAGE_NAME " dash-tx utility version " + FormatFullVersion() + "\n\n" +
"Usage: dash-tx [options] <hex-tx> [commands] Update hex-encoded dash transaction\n" +
"or: dash-tx [options] -create [commands] Create hex-encoded dash transaction\n" +
"\n";
strUsage += gArgs.GetHelpMessage();

View File

@ -81,7 +81,7 @@ static bool AppInit(int argc, char* argv[])
// Process help and version before taking care about datadir
if (HelpRequested(gArgs) || gArgs.IsArgSet("-version")) {
std::string strUsage = strprintf("%s Daemon", PACKAGE_NAME) + " version " + FormatFullVersion() + "\n";
std::string strUsage = PACKAGE_NAME " Daemon version " + FormatFullVersion() + "\n";
if (gArgs.IsArgSet("-version"))
{
@ -89,9 +89,7 @@ static bool AppInit(int argc, char* argv[])
}
else
{
strUsage += "\nUsage:\n"
" dashd [options] " + strprintf("Start %s Daemon", PACKAGE_NAME) + "\n";
strUsage += "\nUsage: dashd [options] Start " PACKAGE_NAME " Daemon\n";
strUsage += "\n" + gArgs.GetHelpMessage();
}

View File

@ -74,8 +74,7 @@ HelpMessageDialog::HelpMessageDialog(interfaces::Node& node, QWidget *parent, He
ui->helpMessage->setVisible(false);
} else if (helpMode == cmdline) {
setWindowTitle(tr("Command-line options"));
QString header = "Usage:\n"
" dash-qt [command-line options] \n";
QString header = "Usage: dash-qt [command-line options] \n";
QTextCursor cursor(ui->helpMessage->document());
cursor.insertText(version);
cursor.insertBlock();
@ -84,7 +83,7 @@ HelpMessageDialog::HelpMessageDialog(interfaces::Node& node, QWidget *parent, He
std::string strUsage = gArgs.GetHelpMessage();
QString coreOptions = QString::fromStdString(strUsage);
text = version + "\n" + header + "\n" + coreOptions;
text = version + "\n\n" + header + "\n" + coreOptions;
QTextTableFormat tf;
tf.setBorderStyle(QTextFrameFormat::BorderStyle_None);