Repository: mesos Updated Branches: refs/heads/master 8ecf8b0a8 -> e930a9785
Allow empty description in the endpoint help information. Review: https://reviews.apache.org/r/39037 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e930a978 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e930a978 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e930a978 Branch: refs/heads/master Commit: e930a9785d9b75c6cc00d3e843917b06a012cdf3 Parents: 8ecf8b0 Author: haosdent huang <[email protected]> Authored: Tue Oct 13 13:48:03 2015 -0700 Committer: Benjamin Mahler <[email protected]> Committed: Tue Oct 13 13:51:03 2015 -0700 ---------------------------------------------------------------------- 3rdparty/libprocess/include/process/help.hpp | 4 +-- 3rdparty/libprocess/src/help.cpp | 31 +++++++++++++---------- 2 files changed, 19 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/e930a978/3rdparty/libprocess/include/process/help.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/include/process/help.hpp b/3rdparty/libprocess/include/process/help.hpp index e7dc670..2412db9 100644 --- a/3rdparty/libprocess/include/process/help.hpp +++ b/3rdparty/libprocess/include/process/help.hpp @@ -47,8 +47,8 @@ namespace process { // See the 'USAGE', 'TLDR', 'DESCRIPTION', and 'REFERENCES' helpers // below to more easily construct your help pages. std::string HELP( - std::string tldr, - std::string description, + const std::string& tldr, + const Option<std::string>& description = None(), const Option<std::string>& references = None()); // Helper for single-line usage that puts it in a blockquote as code http://git-wip-us.apache.org/repos/asf/mesos/blob/e930a978/3rdparty/libprocess/src/help.cpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/src/help.cpp b/3rdparty/libprocess/src/help.cpp index 822c084..3f82c0f 100644 --- a/3rdparty/libprocess/src/help.cpp +++ b/3rdparty/libprocess/src/help.cpp @@ -39,26 +39,29 @@ using std::vector; namespace process { string HELP( - string tldr, - string description, + const string& tldr, + const Option<string>& description, const Option<string>& references) { - // Make sure 'tldr' and 'description' end with a newline. - if (!strings::endsWith(tldr, "\n")) { - tldr += "\n"; + // Construct the help string. + string help = + "### TL;DR; ###\n" + + tldr; + + if (!strings::endsWith(help, "\n")) { + help += "\n"; } - if (!strings::endsWith(description, "\n")) { - description += "\n"; + if (description.isSome()) { + help += + "\n" + "### DESCRIPTION ###\n" + + description.get(); } - // Construct the help string. - string help = - "### TL;DR; ###\n" + - tldr + - "\n" + - "### DESCRIPTION ###\n" + - description; + if (!strings::endsWith(help, "\n")) { + help += "\n"; + } if (references.isSome()) { help += "\n";
