Skip to main content

Argparse frontend library to help making software usage message

Project description

helpgen helps you to make easily help/usage message of command line tools.


Next is a short example of how to use the library :

#!/usr/bin/env python

import sys

from helpgen.decorators import Action
from helpgen.parser import ActionParser

def action_test():
    """run a test"""

    print("I AM A TEST \o/")

@Action('hello', args=['word'])
def action_hello(word):
    """display a word"""

    print("The word is : %s" % (word,))

def main():
    parser = ActionParser(description="helpgen test script")

        return 1
        return 0

if __name__ == "__main__":

This peace of code will produce these help messages :

  • generic help message:
$ ./ -h
usage: [-h] {test,hello} ...

helpgen test script

positional arguments:
    test        run a test
    hello       display a word

optional arguments:
  -h, --help    show this help message and exit
  • help message for test sub command:
$ ./ test -h
usage: test [-h]

optional arguments:
  -h, --help  show this help message and exit
  • help message for hello sub command:
$ ./ hello -h
usage: hello [-h] word

positional arguments:

optional arguments:
  -h, --help  show this help message and exit
  • and, it works fine :
$ ./ test
$ ./ hello "\_o<~ KOIN"
The word is : \_o<~ KOIN

Project details

Release history Release notifications | RSS feed

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

helpgen-0.1.tar.gz (1.5 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page