aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor C. Richberger <Taywee@gmx.com>2016-05-10 16:14:33 -0600
committerTaylor C. Richberger <Taywee@gmx.com>2016-05-10 16:14:33 -0600
commitc14e85caa034de73c7b210b2ed265e6c9bb8f7af (patch)
treedfb29399baf4fdba28095fd5f1c48da739592155
parentmake terminator showing optional (diff)
downloadargs.hxx-c14e85caa034de73c7b210b2ed265e6c9bb8f7af.tar.xz
improve help generation3.0.4
-rw-r--r--Doxyfile2
-rw-r--r--args.hxx32
2 files changed, 31 insertions, 3 deletions
diff --git a/Doxyfile b/Doxyfile
index e796441..4182cbc 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -38,7 +38,7 @@ PROJECT_NAME = "args"
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER = 3.0.3
+PROJECT_NUMBER = 3.0.4
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
diff --git a/args.hxx b/args.hxx
index 0b88924..3a60d77 100644
--- a/args.hxx
+++ b/args.hxx
@@ -765,6 +765,7 @@ namespace args
{
private:
std::string prog;
+ std::string proglinePostfix;
std::string description;
std::string epilog;
@@ -814,6 +815,14 @@ namespace args
/** Show the terminator when both options and positional parameters are present
*/
bool showTerminator = true;
+
+ /** Show the {OPTIONS} on the prog line when this is true
+ */
+ bool showProglineOptions = true;
+
+ /** Show the positionals on the prog line when this is true
+ */
+ bool showProglinePositionals = true;
} helpParams;
ArgumentParser(const std::string &description, const std::string &epilog = std::string()) :
Group("arguments", Group::Validators::AllChildGroups),
@@ -837,6 +846,15 @@ namespace args
void Prog(const std::string &prog)
{ this->prog = prog; }
+ /** The description that appears on the prog line after options and positionals
+ */
+ const std::string &ProglinePostfix() const
+ { return proglinePostfix; }
+ /** The description that appears on the prog line after options and positionals
+ */
+ void ProglinePostfix(const std::string &proglinePostfix)
+ { this->proglinePostfix = proglinePostfix; }
+
/** The description that appears above options
*/
const std::string &Description() const
@@ -946,12 +964,22 @@ namespace args
if (HasFlag())
{
hasoptions = true;
- prognameline << " {OPTIONS}";
+ if (helpParams.showProglineOptions)
+ {
+ prognameline << " {OPTIONS}";
+ }
}
for (const std::string &posname: GetPosNames())
{
hasarguments = true;
- prognameline << " [" << posname << ']';
+ if (helpParams.showProglinePositionals)
+ {
+ prognameline << " [" << posname << ']';
+ }
+ }
+ if (!proglinePostfix.empty())
+ {
+ prognameline << ' ' << proglinePostfix;
}
const std::vector<std::string> proglines(Wrap(prognameline.str(), helpParams.width - (helpParams.progindent + 4), helpParams.width - helpParams.progindent));
auto progit = std::begin(proglines);