From 3f6154ebeb153389ebf6ec1dded6a348dc3d9b58 Mon Sep 17 00:00:00 2001 From: Pavel Belikov Date: Mon, 6 Nov 2017 11:02:34 +0300 Subject: add HelpParams::showCommandChildren and HelpParams::showCommandFullHelp --- test.cxx | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'test.cxx') diff --git a/test.cxx b/test.cxx index 18b8c69..597eaae 100644 --- a/test.cxx +++ b/test.cxx @@ -793,6 +793,69 @@ TEST_CASE("Subparser help works as expected", "[args]") -f flag )"); + + p.ParseArgs(std::vector{}); + s.str(""); + s << p; + REQUIRE(s.str() == R"( git {OPTIONS} + + git-like parser + + OPTIONS: + + -g global flag + add add file contents to the index + commit record changes to the repository + +)"); + + + p.helpParams.showCommandChildren = true; + p.ParseArgs(std::vector{}); + s.str(""); + s << p; + REQUIRE(s.str() == R"( git {OPTIONS} + + git-like parser + + OPTIONS: + + -g global flag + add add file contents to the index + -f flag + commit record changes to the repository + -f flag + +)"); + + commit.Epilog("epilog"); + p.helpParams.showCommandFullHelp = true; + p.ParseArgs(std::vector{}); + s.str(""); + s << p; + REQUIRE(s.str() == R"( git {OPTIONS} + + git-like parser + + OPTIONS: + + -g global flag + add {OPTIONS} + + add file contents to the index + + -f flag + + commit {OPTIONS} + + record changes to the repository + + -f flag + + epilog + +)"); + } #undef ARGS_HXX -- cgit v1.2.1