📜  help.par (1)

📅  最后修改于: 2023-12-03 15:01:07.838000             🧑  作者: Mango

Help.Par

Introduction

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.

Installation

To install Help.Par, follow the steps below:

  1. Open your terminal or command prompt.
  2. Run the command pip install help-par to install Help.Par globally.
  3. Alternatively, you can install it into a virtual environment using pipenv install help-par.
Usage

To use Help.Par, follow the steps below:

  1. Open your terminal or command prompt.
  2. Navigate to the directory where your Python code is located.
  3. Run the command help-par generate to generate the markdown file.
  4. The markdown file will be saved in the same directory as your code with the filename help.md.
Command Line Options

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.
Example
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]
Arguments
  • FOO
  • BAR
Options
  • --foo: Foo the bar
  • --bar: Bar the foo
Examples
example.py --foo foo_value
example.py --bar bar_value