aboutsummaryrefslogtreecommitdiff
path: root/test.cxx
diff options
context:
space:
mode:
authorPavel Belikov <pavel.fuchs.belikov@gmail.com>2017-11-06 11:02:34 +0300
committerPavel Belikov <pavel.fuchs.belikov@gmail.com>2017-11-06 11:02:34 +0300
commit3f6154ebeb153389ebf6ec1dded6a348dc3d9b58 (patch)
treef03c4bbf64df7ceda6fce46789a1db01154c16cf /test.cxx
parentadd help output for commands (diff)
downloadargs.hxx-3f6154ebeb153389ebf6ec1dded6a348dc3d9b58.tar.xz
add HelpParams::showCommandChildren and HelpParams::showCommandFullHelp
Diffstat (limited to 'test.cxx')
-rw-r--r--test.cxx63
1 files changed, 63 insertions, 0 deletions
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<std::string>{});
+ 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<std::string>{});
+ 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<std::string>{});
+ 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