diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-08-07 10:19:09 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-08-07 10:32:53 +0200 |
commit | 37ab117a87bac02a3341f4775e5448ea4793d2c8 (patch) | |
tree | 900a5fb5937a768346563e9ec4dc9eb871b82020 | |
parent | 26f59f5054ef4c045e24be0fd222c39e46670c51 (diff) | |
parent | 7272fdcfe7370412b34a96bc19f3819e03169ef7 (diff) |
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
-rw-r--r-- | src/bitcoin-cli.cpp | 13 | ||||
-rw-r--r-- | src/bitcoin-tx.cpp | 9 | ||||
-rw-r--r-- | src/bitcoind.cpp | 6 | ||||
-rw-r--r-- | src/qt/utilitydialog.cpp | 5 |
4 files changed, 14 insertions, 19 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index a77e3d49b8..24a6dc23b2 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -104,14 +104,13 @@ static int AppInitRPC(int argc, char* argv[]) return EXIT_FAILURE; } 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" - " bitcoin-cli [options] <command> [params] " + strprintf("Send command to %s", PACKAGE_NAME) + "\n" + - " bitcoin-cli [options] -named <command> [name=value] ... " + strprintf("Send command to %s (with named arguments)", PACKAGE_NAME) + "\n" + - " bitcoin-cli [options] help List commands\n" + - " bitcoin-cli [options] help <command> Get help for a command\n"; - + strUsage += "\n" + "Usage: bitcoin-cli [options] <command> [params] Send command to " PACKAGE_NAME "\n" + "or: bitcoin-cli [options] -named <command> [name=value]... Send command to " PACKAGE_NAME " (with named arguments)\n" + "or: bitcoin-cli [options] help List commands\n" + "or: bitcoin-cli [options] help <command> Get help for a command\n"; strUsage += "\n" + gArgs.GetHelpMessage(); } diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index 181e2bb1bc..5fef4724c9 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -98,11 +98,10 @@ 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 bitcoin-tx utility version", PACKAGE_NAME) + " " + FormatFullVersion() + "\n\n" + - "Usage:\n" - " bitcoin-tx [options] <hex-tx> [commands] Update hex-encoded bitcoin transaction\n" + - " bitcoin-tx [options] -create [commands] Create hex-encoded bitcoin transaction\n" + - "\n"; + std::string strUsage = PACKAGE_NAME " bitcoin-tx utility version " + FormatFullVersion() + "\n\n" + + "Usage: bitcoin-tx [options] <hex-tx> [commands] Update hex-encoded bitcoin transaction\n" + + "or: bitcoin-tx [options] -create [commands] Create hex-encoded bitcoin transaction\n" + + "\n"; strUsage += gArgs.GetHelpMessage(); fprintf(stdout, "%s", strUsage.c_str()); diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 4d010c0d14..06f8622426 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -71,7 +71,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")) { @@ -79,9 +79,7 @@ static bool AppInit(int argc, char* argv[]) } else { - strUsage += "\nUsage:\n" - " bitcoind [options] " + strprintf("Start %s Daemon", PACKAGE_NAME) + "\n"; - + strUsage += "\nUsage: bitcoind [options] Start " PACKAGE_NAME " Daemon\n"; strUsage += "\n" + gArgs.GetHelpMessage(); } diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp index 1da25b0761..c9469593a5 100644 --- a/src/qt/utilitydialog.cpp +++ b/src/qt/utilitydialog.cpp @@ -70,8 +70,7 @@ HelpMessageDialog::HelpMessageDialog(interfaces::Node& node, QWidget *parent, bo ui->helpMessage->setVisible(false); } else { setWindowTitle(tr("Command-line options")); - QString header = "Usage:\n" - " bitcoin-qt [command-line options] \n"; + QString header = "Usage: bitcoin-qt [command-line options] \n"; QTextCursor cursor(ui->helpMessage->document()); cursor.insertText(version); cursor.insertBlock(); @@ -80,7 +79,7 @@ HelpMessageDialog::HelpMessageDialog(interfaces::Node& node, QWidget *parent, bo 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); |