Skip to content

Commit

Permalink
[Docs] Reformat -help output for help2man
Browse files Browse the repository at this point in the history
Github-Pull: #2491
Rebased-From: d510ce0
  • Loading branch information
Fuzzbawls authored and furszy committed Sep 19, 2021
1 parent 656be59 commit ecdbf86
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
13 changes: 6 additions & 7 deletions src/pivx-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,13 @@ static bool AppInitRPC(int argc, char* argv[])
//
gArgs.ParseParameters(argc, argv);
if (argc < 2 || gArgs.IsArgSet("-?") || gArgs.IsArgSet("-h") || gArgs.IsArgSet("-help") || 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"
" pivx-cli [options] <command> [params] " + strprintf("Send command to %s", PACKAGE_NAME) + "\n" +
" pivx-cli [options] -named <command> [name=value] ... " + strprintf("Send command to %s (with named arguments)", PACKAGE_NAME) + "\n" +
" pivx-cli [options] help List commands\n" +
" pivx-cli [options] help <command> Get help for a command\n";

strUsage += "\n"
"Usage: pivx-cli [options] <command> [params] Send command to " PACKAGE_NAME "\n"
"or: pivx-cli [options] -named <command> [name=value]... Send command to " PACKAGE_NAME " (with named arguments)\n"
"or: pivx-cli [options] help List commands\n"
"or: pivx-cli [options] help <command> Get help for a command\n";
strUsage += "\n" + HelpMessageCli();
}

Expand Down
7 changes: 3 additions & 4 deletions src/pivx-tx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ static bool AppInitRawTx(int argc, char* argv[])

if (argc < 2 || gArgs.IsArgSet("-?") || gArgs.IsArgSet("-h") || gArgs.IsArgSet("-help")) {
// First part of help message is specific to this utility
std::string strUsage = strprintf("%s pivx-tx utility version", PACKAGE_NAME) + " " + FormatFullVersion() + "\n\n" +
"Usage:\n"
" pivx-tx [options] <hex-tx> [commands] Update hex-encoded pivx transaction\n" +
" pivx-tx [options] -create [commands] Create hex-encoded pivx transaction\n" +
std::string strUsage = PACKAGE_NAME " pivx-tx utility version " + FormatFullVersion() + "\n\n" +
"Usage: pivx-tx [options] <hex-tx> [commands] Update hex-encoded pivx transaction\n" +
"or: pivx-tx [options] -create [commands] Create hex-encoded pivx transaction\n" +
"\n";

fprintf(stdout, "%s", strUsage.c_str());
Expand Down
6 changes: 2 additions & 4 deletions src/pivxd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,12 @@ bool AppInit(int argc, char* argv[])

// Process help and version before taking care about datadir
if (gArgs.IsArgSet("-?") || gArgs.IsArgSet("-h") || gArgs.IsArgSet("-help") || 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")) {
strUsage += LicenseInfo();
} else {
strUsage += "\nUsage:\n"
" pivxd [options] " + strprintf("Start %s Daemon", PACKAGE_NAME) + "\n";

strUsage += "\nUsage: pivxd [options] Start " PACKAGE_NAME " Daemon\n";
strUsage += "\n" + HelpMessage(HMM_BITCOIND);
}

Expand Down
5 changes: 2 additions & 3 deletions src/qt/utilitydialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ HelpMessageDialog::HelpMessageDialog(QWidget* parent, bool about) : QDialog(pare
ui->helpMessage->setVisible(false);
} else {
setWindowTitle(tr("Command-line options"));
QString header = "Usage:\n"
" pivx-qt [command-line options] \n";
QString header = "Usage: pivx-qt [command-line options] \n";
QTextCursor cursor(ui->helpMessage->document());
cursor.insertText(version);
cursor.insertBlock();
Expand All @@ -88,7 +87,7 @@ HelpMessageDialog::HelpMessageDialog(QWidget* parent, bool about) : QDialog(pare
strUsage += HelpMessageOpt("-splash", strprintf("Show splash screen on startup (default: %u)", DEFAULT_SPLASHSCREEN));
strUsage += HelpMessageOpt("-hidecharts", strprintf("Hide QT staking charts on startup (default: %u)", false));
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);
Expand Down

0 comments on commit ecdbf86

Please sign in to comment.