📅  最后修改于: 2023-12-03 15:01:07.838000             🧑  作者: Mango
Help.Par is a command line tool that enables programmers to generate a markdown file which can serve as a template for writing help documentation for their code.
To install Help.Par, follow the steps below:
pip install help-par
to install Help.Par globally.pipenv install help-par
.To use Help.Par, follow the steps below:
help-par generate
to generate the markdown file.help.md
.The following command line options are available:
help-par generate
- generates the markdown file.--name
- specifies the name of the markdown file to generate.--description
- adds a description section to the markdown file.--usage
- adds a usage section to the markdown file.--arguments
- adds an arguments section to the markdown file.--options
- adds an options section to the markdown file.--examples
- adds an examples section to the markdown file.import argparse
parser = argparse.ArgumentParser(description='An example script.')
parser.add_argument('--foo', help='Foo the bar')
parser.add_argument('--bar', help='Bar the foo')
args = parser.parse_args()
if args.foo:
print('Fooing the bar...')
elif args.bar:
print('Baring the foo...')
else:
print('Nothing to do...')
$ help-par generate --name=example --description="An example script" --usage="example.py --foo [FOO] --bar [BAR]" --arguments="FOO, BAR" --options="--foo: Foo the bar\n--bar: Bar the foo" --examples="example.py --foo foo_value\nexample.py --bar bar_value"
This will generate a markdown file named example.md
with the following contents:
# Example
An example script
## Usage
```bash
example.py --foo [FOO] --bar [BAR]
FOO
BAR
--foo
: Foo the bar--bar
: Bar the fooexample.py --foo foo_value
example.py --bar bar_value