aboutsummaryrefslogtreecommitdiff
path: root/paludis/args/man.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-09-02 17:17:41 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-09-02 17:17:41 +0100
commit9e23047346d2d7f8e3de4aa21e7915158ec1e413 (patch)
tree8f05c3ddbc953f8405770d089394f3dee8bb03df /paludis/args/man.cc
parentcc02729c347c1bc8d2a3ef8b939fe298588aa30b (diff)
downloadpaludis-9e23047346d2d7f8e3de4aa21e7915158ec1e413.tar.gz
paludis-9e23047346d2d7f8e3de4aa21e7915158ec1e413.tar.xz
Support args sections
Diffstat (limited to 'paludis/args/man.cc')
-rw-r--r--paludis/args/man.cc46
1 files changed, 26 insertions, 20 deletions
diff --git a/paludis/args/man.cc b/paludis/args/man.cc
index 17ba90a0d..63de28671 100644
--- a/paludis/args/man.cc
+++ b/paludis/args/man.cc
@@ -24,6 +24,7 @@
#include <ostream>
#include <sstream>
#include <algorithm>
+#include <ctype.h>
using namespace paludis;
using namespace paludis::args;
@@ -111,28 +112,31 @@ paludis::args::generate_doc(DocWriter & dw, const ArgsHandler * const h)
dw.extra_description(*u);
dw.end_description();
- dw.start_options();
- for (ArgsHandler::ArgsGroupsConstIterator a(h->begin_args_groups()),
- a_end(h->end_args_groups()) ; a != a_end ; ++a)
+ for (ArgsHandler::ArgsSectionsConstIterator s(h->begin_args_sections()), s_end(h->end_args_sections()) ;
+ s != s_end ; ++s)
{
- dw.start_arg_group((*a)->name(), (*a)->description());
-
- for (paludis::args::ArgsGroup::ConstIterator b((*a)->begin()), b_end((*a)->end()) ;
- b != b_end ; ++b)
+ dw.start_options(s->name());
+ for (ArgsSection::GroupsConstIterator a(s->begin()),
+ a_end(s->end()) ; a != a_end ; ++a)
{
- if (simple_visitor_cast<const paludis::args::AliasArg>(**b) &&
- simple_visitor_cast<const paludis::args::AliasArg>(**b)->hidden())
- continue;
+ dw.start_arg_group(a->name(), a->description());
- dw.arg_group_item((*b)->short_name(), (*b)->long_name(),
- (*b)->can_be_negated() ? "no-" + (*b)->long_name() : "", (*b)->description());
+ for (paludis::args::ArgsGroup::ConstIterator b(a->begin()), b_end(a->end()) ;
+ b != b_end ; ++b)
+ {
+ if (simple_visitor_cast<const paludis::args::AliasArg>(**b) &&
+ simple_visitor_cast<const paludis::args::AliasArg>(**b)->hidden())
+ continue;
- ExtraText t(dw);
- (*b)->accept(t);
+ dw.arg_group_item((*b)->short_name(), (*b)->long_name(),
+ (*b)->can_be_negated() ? "no-" + (*b)->long_name() : "", (*b)->description());
- }
+ ExtraText t(dw);
+ (*b)->accept(t);
- dw.end_arg_group();
+ }
+ dw.end_arg_group();
+ }
}
dw.end_options();
@@ -203,9 +207,9 @@ HtmlWriter::start_description(const std::string & description)
}
void
-HtmlWriter::start_options()
+HtmlWriter::start_options(const std::string & s)
{
- _os << "<h2>Options</h2>" << endl;
+ _os << "<h2>" << s << "</h2>" << endl;
}
void
@@ -393,9 +397,11 @@ ManWriter::start_description(const std::string & description)
}
void
-ManWriter::start_options()
+ManWriter::start_options(const std::string & s)
{
- _os << ".SH OPTIONS" << endl;
+ std::string upper_s;
+ std::transform(s.begin(), s.end(), std::back_inserter(upper_s), &::toupper);
+ _os << ".SH " << upper_s << endl;
}
void