help2man¶
Convert --help
and --version
to man page.
Similar Projects¶
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.
Intention¶
This a python version of GNU help2man. It solves the following problems[1]:
GNU help2man
cannot convert argparse
correctly¶
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.
GNU help2man
cannot customize template¶
I provide help2man --template XXX
and help2man --template-file XXX
to do
it. The template language is
jinja2. See
template
as examples.
GNU help2man don’t provide any programming API¶
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.