aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ingmar Vanhassel <ingmar@exherbo.org> 2009-11-12 06:44:40 +0100
committerAvatar Ingmar Vanhassel <ingmar@exherbo.org> 2010-06-19 21:38:04 +0200
commit01a45de28ed301c2a70e333f95059284bf4bd216 (patch)
tree978215d4a09c4fee824c3faf514b0a2d4b364e31
parentfcd72c77de4cd249b4de3faac8032341547399fb (diff)
downloadpaludis-01a45de28ed301c2a70e333f95059284bf4bd216.tar.gz
paludis-01a45de28ed301c2a70e333f95059284bf4bd216.tar.xz
Args::DocWriter: Don't output empty usage sections
-rw-r--r--paludis/args/man.cc12
-rw-r--r--paludis/args/man.hh3
2 files changed, 15 insertions, 0 deletions
diff --git a/paludis/args/man.cc b/paludis/args/man.cc
index 63de286..eb79370 100644
--- a/paludis/args/man.cc
+++ b/paludis/args/man.cc
@@ -102,6 +102,8 @@ paludis::args::generate_doc(DocWriter & dw, const ArgsHandler * const h)
for (ArgsHandler::UsageLineConstIterator u(h->begin_usage_lines()),
u_end(h->end_usage_lines()) ; u != u_end ; ++u)
{
+ if (u == h->begin_usage_lines())
+ dw.start_usage_lines();
dw.usage_line(h->app_name(), *u);
}
@@ -190,6 +192,11 @@ HtmlWriter::heading(const std::string & name, const std::string & section_, cons
_os << "<h1>" << name << "(" << section_ << ")" << "</h1>" << endl;
_os << "<h2>Name</h2>" << endl;
_os << "<p>" << name << " - " << synopsis << "</p>" << endl;
+}
+
+void
+HtmlWriter::start_usage_lines()
+{
_os << "<h2>Synopsis</h2>" << endl;
}
@@ -380,6 +387,11 @@ ManWriter::heading(const std::string & name, const std::string & section_, const
_os << ".TH \"" << name << "\" " << section_ << endl;
_os << ".SH NAME" << endl;
_os << name << " \\- " << synopsis << endl;
+}
+
+void
+ManWriter::start_usage_lines()
+{
_os << ".SH SYNOPSIS" << endl;
}
diff --git a/paludis/args/man.hh b/paludis/args/man.hh
index 236a332..fb79d07 100644
--- a/paludis/args/man.hh
+++ b/paludis/args/man.hh
@@ -57,6 +57,7 @@ namespace paludis
virtual void heading(const std::string & name, const std::string & section,
const std::string & synopsis) = 0;
+ virtual void start_usage_lines() = 0;
virtual void usage_line(const std::string & name, const std::string & line) = 0;
virtual void start_description(const std::string & description) = 0;
@@ -116,6 +117,7 @@ namespace paludis
void heading(const std::string & name, const std::string & section,
const std::string & synopis);
+ void start_usage_lines();
void usage_line(const std::string & name, const std::string & line);
void start_description(const std::string & description);
@@ -173,6 +175,7 @@ namespace paludis
void heading(const std::string & name, const std::string & section,
const std::string & synopis);
+ void start_usage_lines();
void usage_line(const std::string & name, const std::string & line);
void start_description(const std::string & description);