Skip to main content

A library to manage command line interface for an application.

Project description

A simple library to handle command line of an application with support for subcommands, as well as, automatic help text extraction from doc strings.

Supported platforms

  • python 2.7 / 3.4

  • Linux / Windows

Features

  • Decorator as well as subclass based command addition.

  • Custom help text formatter which improves upon the rather lousy default formatter.

  • Automatic help text extraction from doc strings.

  • Autocomplete support (Linux only).

Usage

A simple case of just the main command (without any subcommands):

from redcmd.api import maincmd, execute_commandline

@maincmd
def main(a, b):
        '''Add two numbers.
        a:      first number
        b:      second number

        This is where extra help text goes.
        It can be more than one line.'''

        try:
                print('sum: %d'%(int(a) + int(b)))
        except ValueError:
                print('bad integer')
                raise CommandError()

execute_commandline()

See examples directory in code for decorator and subclass based command handling. [https://github.com/amol9/redcmd/tree/master/examples]

Download

Project details


Download files

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

Source Distribution

redcmd-1.2.10.tar.gz (24.1 kB view details)

Uploaded Source

File details

Details for the file redcmd-1.2.10.tar.gz.

File metadata

  • Download URL: redcmd-1.2.10.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for redcmd-1.2.10.tar.gz
Algorithm Hash digest
SHA256 86a2ec97f3f6f88c9ccb60418e17960248ae05bd4d127914b2f0d7e3788632bf
MD5 f3c0d58fa91f5d44de1b8030b40c2931
BLAKE2b-256 48f299ba0f9b7e073fa8eec723a46a202ce423ca64f7a69c01308748a969b18c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page