aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ingmar Vanhassel <ingmar@exherbo.org> 2011-02-16 17:07:26 +0000
committerAvatar Ingmar Vanhassel <ingmar@exherbo.org> 2011-02-16 17:07:26 +0000
commit8e11571b026bc33a42f2a42065511d330fa13589 (patch)
tree9294ecd1e3c6876f392dfee24491815104f06957
parente6d1c28fbc15ae287fc5641fe1d365bddd113b9f (diff)
downloadpaludis-8e11571b026bc33a42f2a42065511d330fa13589.tar.gz
paludis-8e11571b026bc33a42f2a42065511d330fa13589.tar.xz
Asciidocify appareo
-rw-r--r--.gitignore2
-rw-r--r--src/clients/appareo/Makefile.am22
-rw-r--r--src/clients/appareo/man_appareo.cc20
3 files changed, 32 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index 19850f2..f5079fb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -494,6 +494,8 @@ paludis-*.*.*.tar.bz2
/src/clients/accerso/*.txt
/src/clients/accerso/*.xml
/src/clients/appareo/appareo
+/src/clients/appareo/*.txt
+/src/clients/appareo/*.xml
/src/clients/cave/cave
/src/clients/cave/*.txt
/src/clients/cave/*.xml
diff --git a/src/clients/appareo/Makefile.am b/src/clients/appareo/Makefile.am
index 5a668c1..fcc2b94 100644
--- a/src/clients/appareo/Makefile.am
+++ b/src/clients/appareo/Makefile.am
@@ -14,8 +14,20 @@ bin_PROGRAMS = appareo
noinst_PROGRAMS = man-appareo
man_MANS = appareo.1
-appareo.1 : man-appareo
- ./man-appareo > $@
+SUFFIXES = .1 .txt .xml
+
+man_MANS_txts = appareo.txt
+man_MANS_xmls = accerso.xml
+
+$(man_MANS_txts) : man-appareo
+ if ! ./man-appareo --asciidoc `echo $@ | sed -e 's.^appareo-*..' -e 's,\.txt$$,,'` > $@ ; then rm -f $@ ; exit 1 ; fi
+
+.txt.xml :
+ asciidoc --doctype=manpage --backend=docbook --out-file=$@ $<
+
+.xml.1 :
+ xmlto man $<
+ @: $@
man_appareo_SOURCES = \
man_appareo.cc \
@@ -47,5 +59,9 @@ EXTRA_DIST = \
$(man_MANS) \
$(TESTS)
-DISTCLEANFILES = $(man_MANS) $(noinst_DATA)
+DISTCLEANFILES = \
+ $(man_MANS) \
+ $(noinst_DATA) \
+ $(man_MANS_txts) \
+ $(man_MANS_xmls)
diff --git a/src/clients/appareo/man_appareo.cc b/src/clients/appareo/man_appareo.cc
index 26f3794..702a70a 100644
--- a/src/clients/appareo/man_appareo.cc
+++ b/src/clients/appareo/man_appareo.cc
@@ -19,6 +19,7 @@
#include "command_line.hh"
#include <paludis/args/man.hh>
+#include <paludis/args/do_help.hh>
#include <iostream>
#include <cstdlib>
@@ -32,10 +33,12 @@ namespace
paludis::args::ArgsHandler
{
paludis::args::ArgsGroup group;
+ paludis::args::SwitchArg a_asciidoc;
paludis::args::SwitchArg a_html;
ManCommandLine() :
group(main_options_section(), "", ""),
+ a_asciidoc(&group, "asciidoc", '\0', "", false),
a_html(&group, "html", '\0', "", false)
{
}
@@ -63,16 +66,15 @@ main(int argc, char * argv[])
ManCommandLine cmdline;
cmdline.run(argc, argv, "", "", "");
- if (cmdline.a_html.specified())
- {
- paludis::args::HtmlWriter hw(cout);
- paludis::args::generate_doc(hw, CommandLine::get_instance());
- }
+ std::shared_ptr<paludis::args::DocWriter> w;
+ if (cmdline.a_asciidoc.specified())
+ w = std::make_shared<paludis::args::AsciidocWriter>(cout);
+ else if (cmdline.a_html.specified())
+ w = std::make_shared<paludis::args::HtmlWriter>(cout);
else
- {
- paludis::args::ManWriter mw(cout);
- paludis::args::generate_doc(mw, CommandLine::get_instance());
- }
+ throw paludis::args::DoHelp("No format specified");
+
+ paludis::args::generate_doc(*w, CommandLine::get_instance());
return EXIT_SUCCESS;
}