65 virtual void usage(TCLAP::CmdLineInterface& _cmd)
68 std::cout << std::endl <<
"USAGE: " << std::endl << std::endl;
69 _shortUsage(_cmd, std::cout);
70 std::cout << std::endl
72 <<
"Where: " << std::endl
75 std::string
const message = _cmd.getMessage();
76 std::list<TCLAP::ArgGroup*> argSets = _cmd.getArgGroups();
78 std::list<TCLAP::Arg*> unlabelled;
79 for (std::list<TCLAP::ArgGroup*>::iterator sit = argSets.begin();
83 TCLAP::ArgGroup& argGroup = **sit;
85 int const visible = CountVisibleArgs(argGroup);
86 bool const exclusive = visible > 1 && argGroup.isExclusive();
87 bool const forceRequired = visible == 1 && argGroup.isRequired();
91 argGroup.isRequired() ?
"One of:" :
"Either of:", 75,
95 for (TCLAP::ArgGroup::iterator it = argGroup.begin();
99 TCLAP::Arg& arg = **it;
101 if (!arg.visibleInHelp())
108 unlabelled.push_back(&arg);
113 std::string
const shortID = arg.shortID();
115 bool const required = arg.isRequired() || forceRequired;
116 std::stringstream ss;
117 if (std::regex_search(shortID, match, std::regex(
"<([^>]+)>")))
119 std::string
const identifier = match[1];
131 ss << arg.getDescription(required);
135 spacePrint(std::cout, arg.longID(), 75, 6, 3);
136 spacePrint(std::cout, ss.str(), 75, 8, 0);
140 spacePrint(std::cout, arg.longID(), 75, 3, 3);
141 spacePrint(std::cout, ss.str(), 75, 5, 0);
147 for (TCLAP::ArgListIterator it = unlabelled.begin();
148 it != unlabelled.end();
151 const TCLAP::Arg& arg = **it;
152 spacePrint(std::cout, arg.longID(), 75, 3, 3);
153 spacePrint(std::cout, arg.getDescription(), 75, 5, 0);
157 if (!message.empty())
159 spacePrint(std::cout, message, 75, 3, 0);