aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
authorLuca Venturini <luca@yepa.com>2015-02-04 00:11:49 -0800
committerLuca Venturini <luca@yepa.com>2015-03-10 22:07:17 -0700
commit1fdb9fa3f905df956ed61dbf6ae086c963fd1793 (patch)
treee41a28ea27ed9d6a43a0ce375f7c251c0de40e5d /src/util.cpp
parent8cbe1f4f5870a165be729cabb9b55dcbf0f85e09 (diff)
downloadbitcoin-1fdb9fa3f905df956ed61dbf6ae086c963fd1793.tar.xz
Help messages correctly formatted (79 chars)
Help messages are formatted programmatically with FormatParagraph in order not to break existing strings in Transifex. The new format works even if the translation of the strings modifies the lenght of the message. Sqashed 6 commits in a single one. Help messages correctly formatted for SVGA text mode (132 chars) Help messages are formatted programmatically with FormatParagraph in order not to break existing strings in Transifex. The new format should work even if the translation of the strings modifies the lenght of the message. Fix - syntax error Correct formatting for 79 chars Correctly based on C++ functions Removed spare spaces from option strings Fix - syntax error
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 361b3631f5..792f00b61d 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -346,6 +346,21 @@ bool SoftSetBoolArg(const std::string& strArg, bool fValue)
return SoftSetArg(strArg, std::string("0"));
}
+static const int screenWidth = 79;
+static const int optIndent = 2;
+static const int msgIndent = 7;
+
+std::string HelpMessageGroup(const std::string &message) {
+ return std::string(message) + std::string("\n\n");
+}
+
+std::string HelpMessageOpt(const std::string &option, const std::string &message) {
+ return std::string(optIndent,' ') + std::string(option) +
+ std::string("\n") + std::string(msgIndent,' ') +
+ FormatParagraph(message, screenWidth - msgIndent, msgIndent) +
+ std::string("\n\n");
+}
+
static std::string FormatException(const std::exception* pex, const char* pszThread)
{
#ifdef WIN32