MCPcopy Create free account
hub / github.com/OpenVPN/openvpn3-linux / gen_help

Method gen_help

src/common/cmdargparser.cpp:875–910  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

873
874
875std::string SingleCommand::gen_help(const std::string arg0)
876{
877 std::stringstream r;
878 r << arg0 << ": " << command << " - " << description << std::endl;
879 r << std::endl;
880
881 std::stringstream cmt_before;
882 for (const auto &c : comments)
883 {
884 cmt_before << c.GetComment(CommentPlacement::BEFORE_OPTS);
885 }
886 if (!cmt_before.str().empty())
887 {
888 r << cmt_before.str() << std::endl;
889 }
890
891 for (const auto &opt : options)
892 {
893 for (const auto &l : opt->gen_help_line())
894 {
895 r << " " << l << std::endl;
896 }
897 }
898
899 std::stringstream cmt_after;
900 for (const auto &c : comments)
901 {
902 cmt_after << c.GetComment(CommentPlacement::AFTER_OPTS);
903 }
904 if (!cmt_after.str().empty())
905 {
906 r << std::endl
907 << cmt_after.str();
908 }
909 return r.str();
910}
911
912
913

Callers

nothing calls this directly

Calls 4

GetCommentMethod · 0.80
gen_help_lineMethod · 0.80
emptyMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected