aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ingmar Vanhassel <ingmar@exherbo.org> 2011-02-17 01:45:38 +0000
committerAvatar Ingmar Vanhassel <ingmar@exherbo.org> 2011-02-17 01:45:38 +0000
commit97699e765cfd12bea225e741ed4a561a8382ec21 (patch)
treed43ba77880bb8e99b971a74ded535e379afb22fb
parent8e11571b026bc33a42f2a42065511d330fa13589 (diff)
downloadpaludis-97699e765cfd12bea225e741ed4a561a8382ec21.tar.gz
paludis-97699e765cfd12bea225e741ed4a561a8382ec21.tar.xz
Asciidocify instruo
-rw-r--r--src/clients/instruo/Makefile.am22
-rw-r--r--src/clients/instruo/man_instruo.cc20
2 files changed, 30 insertions, 12 deletions
diff --git a/src/clients/instruo/Makefile.am b/src/clients/instruo/Makefile.am
index c4a7d6a..d519fc6 100644
--- a/src/clients/instruo/Makefile.am
+++ b/src/clients/instruo/Makefile.am
@@ -14,8 +14,20 @@ bin_PROGRAMS = instruo
noinst_PROGRAMS = man-instruo
man_MANS = instruo.1
-instruo.1 : man-instruo
- ./man-instruo > $@
+SUFFIXES = .1 .txt .xml
+
+man_MANS_txts = instruo.txt
+man_MANS_xmls = instruo.xml
+
+$(man_MANS_txts) : man-instruo
+ if ! ./man-instruo --asciidoc `echo $@ | sed -e 's.^instruo-*..' -e 's,\.txt$$,,'` > $@ ; then rm -f $@ ; exit 1 ; fi
+
+.txt.xml :
+ asciidoc --doctype=manpage --backend=docbook --out-file=$@ $<
+
+.xml.1 :
+ xmlto man $<
+ @: $@
man_instruo_SOURCES = \
man_instruo.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/instruo/man_instruo.cc b/src/clients/instruo/man_instruo.cc
index b78195d..6903075 100644
--- a/src/clients/instruo/man_instruo.cc
+++ b/src/clients/instruo/man_instruo.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;
}