Convert --help
and --version
to man page.
- GNU help2man Generate manpage for
any program with
--help
and--version
. Written in perl. - click-man Generate manpage for click-based python program. Written in python.
- cli2man Generate manpage and
markdown for any program with
--help
and--version
. Written in python. - This project: Generate manpage, markdown or any format (if you provide
a jinja template) for
any program with
--help
and--version
or any argparse-based python program.
This a python version of GNU help2man. It solves the following problems1:
Because argparse outputs:
usage: help2man [-h] ...
executable ...
Convert --help and --version to man page.
positional arguments:
executable executable program name
...
options:
-h show this help message and exit
...
help2man
will ignore positional arguments:
and options:
because it only
detect Options:
. And it only detect first line as synopsis and detect other
lines as description incorrectly.
I provide help2man --template XXX
and help2man --template-file XXX
to do
it. The template language is
jinja2. See
template
as examples.
Now you can use it in python. If you want to generate man pages automatically when you build a python project, you can see setuptools-generate:
See document to know more.
Footnotes
-
I send email to the author of
GNU help2man
but got no response. ↩