improve visual grouping of --help output

use argparse's ArgumentGroups to separate the argparse options for each of the
processors
This commit is contained in:
Martin A. Brown 2016-02-27 09:45:32 -08:00
parent eac92b5354
commit 55cc7d5775
4 changed files with 38 additions and 30 deletions

View File

@ -159,27 +159,29 @@ class Docbook4XML(BaseDoctype, SignatureChecker):
s = 'ln -svr -- "{output.name_html}" "{output.name_indexhtml}"'
return self.shellscript(s)
@staticmethod
def argparse(p):
p.add_argument('--docbook4xml-xslchunk', type=arg_isreadablefile,
@classmethod
def argparse(cls, p):
descrip = 'executables and data files for %s' % (cls.formatname,)
g = p.add_argument_group(title=cls.__name__, description=descrip)
g.add_argument('--docbook4xml-xslchunk', type=arg_isreadablefile,
default=xslchunk_finder(),
help='full path to LDP HTML chunker XSL [%(default)s]')
p.add_argument('--docbook4xml-xslsingle', type=arg_isreadablefile,
g.add_argument('--docbook4xml-xslsingle', type=arg_isreadablefile,
default=xslsingle_finder(),
help='full path to LDP HTML single-page XSL [%(default)s]')
p.add_argument('--docbook4xml-xslprint', type=arg_isreadablefile,
g.add_argument('--docbook4xml-xslprint', type=arg_isreadablefile,
default=xslprint_finder(),
help='full path to LDP FO print XSL [%(default)s]')
p.add_argument('--docbook4xml-xsltproc', type=arg_isexecutable,
g.add_argument('--docbook4xml-xsltproc', type=arg_isexecutable,
default=which('xsltproc'),
help='full path to xsltproc [%(default)s]')
p.add_argument('--docbook4xml-html2text', type=arg_isexecutable,
g.add_argument('--docbook4xml-html2text', type=arg_isexecutable,
default=which('html2text'),
help='full path to html2text [%(default)s]')
p.add_argument('--docbook4xml-fop', type=arg_isexecutable,
g.add_argument('--docbook4xml-fop', type=arg_isexecutable,
default=which('fop'),
help='full path to fop [%(default)s]')
p.add_argument('--docbook4xml-dblatex', type=arg_isexecutable,
g.add_argument('--docbook4xml-dblatex', type=arg_isexecutable,
default=which('dblatex'),
help='full path to dblatex [%(default)s]')

View File

@ -30,18 +30,20 @@ class Docbook5XML(BaseDoctype, SignatureChecker):
def create_htmls(self):
logger.info("Creating single page HTML for %s", self.source.stem)
@staticmethod
def argparse(p):
p.add_argument('--docbook5xml-xsltproc', type=which,
@classmethod
def argparse(cls, p):
descrip = 'executables for %s' % (cls.formatname,)
g = p.add_argument_group(title=cls.__name__, description=descrip)
g.add_argument('--docbook5xml-xsltproc', type=which,
default=which('xsltproc'),
help='full path to xsltproc [%(default)s]')
p.add_argument('--docbook5xml-html2text', type=which,
g.add_argument('--docbook5xml-html2text', type=which,
default=which('html2text'),
help='full path to html2text [%(default)s]')
p.add_argument('--docbook5xml-fop', type=which,
g.add_argument('--docbook5xml-fop', type=which,
default=which('fop'),
help='full path to fop [%(default)s]')
p.add_argument('--docbook5xml-dblatex', type=which,
g.add_argument('--docbook5xml-dblatex', type=which,
default=which('dblatex'),
help='full path to dblatex [%(default)s]')

View File

@ -237,28 +237,30 @@ class DocbookSGML(BaseDoctype, SignatureChecker):
s = 'ln -svr -- "{output.name_html}" "{output.name_indexhtml}"'
return self.shellscript(s)
@staticmethod
def argparse(p):
p.add_argument('--docbooksgml-docbookdsl', type=arg_isreadablefile,
@classmethod
def argparse(cls, p):
descrip = 'executables and data files for %s' % (cls.formatname,)
g = p.add_argument_group(title=cls.__name__, description=descrip)
g.add_argument('--docbooksgml-docbookdsl', type=arg_isreadablefile,
default=docbookdsl_finder(),
help='full path to html/docbook.dsl [%(default)s]')
p.add_argument('--docbooksgml-ldpdsl', type=arg_isreadablefile,
g.add_argument('--docbooksgml-ldpdsl', type=arg_isreadablefile,
default=ldpdsl_finder(),
help='full path to ldp/ldp.dsl [%(default)s]')
p.add_argument('--docbooksgml-jw', type=arg_isexecutable,
g.add_argument('--docbooksgml-jw', type=arg_isexecutable,
default=which('jw'),
help='full path to jw [%(default)s]')
p.add_argument('--docbooksgml-html2text', type=arg_isexecutable,
g.add_argument('--docbooksgml-html2text', type=arg_isexecutable,
default=which('html2text'),
help='full path to html2text [%(default)s]')
p.add_argument('--docbooksgml-openjade', type=arg_isexecutable,
g.add_argument('--docbooksgml-openjade', type=arg_isexecutable,
default=which('openjade'),
help='full path to openjade [%(default)s]')
p.add_argument('--docbooksgml-dblatex', type=arg_isexecutable,
g.add_argument('--docbooksgml-dblatex', type=arg_isexecutable,
default=which('dblatex'),
help='full path to dblatex [%(default)s]')
p.add_argument('--docbooksgml-collateindex', type=arg_isexecutable,
default=which('collateindex'),
g.add_argument('--docbooksgml-collateindex', type=arg_isexecutable,
default=which('collateindex.pl'),
help='full path to collateindex [%(default)s]')
#

View File

@ -89,15 +89,17 @@ class Linuxdoc(BaseDoctype, SignatureChecker):
s = 'ln -svr -- "{output.name_html}" "{output.name_indexhtml}"'
return self.shellscript(s)
@staticmethod
def argparse(p):
p.add_argument('--linuxdoc-sgml2html', type=arg_isexecutable,
@classmethod
def argparse(cls, p):
descrip = 'executables and data files for %s' % (cls.formatname,)
g = p.add_argument_group(title=cls.__name__, description=descrip)
g.add_argument('--linuxdoc-sgml2html', type=arg_isexecutable,
default=which('sgml2html'),
help='full path to sgml2html [%(default)s]')
p.add_argument('--linuxdoc-html2text', type=arg_isexecutable,
g.add_argument('--linuxdoc-html2text', type=arg_isexecutable,
default=which('html2text'),
help='full path to html2text [%(default)s]')
p.add_argument('--linuxdoc-htmldoc', type=arg_isexecutable,
g.add_argument('--linuxdoc-htmldoc', type=arg_isexecutable,
default=which('htmldoc'),
help='full path to htmldoc [%(default)s]')