Skip to main content

A framework that facilitates shell and batch scripting in Python

Project description

Introduction

BlazeCommandHelper (BCH) is a framework that facilitates the quick creation of shell and batch scripts. It provides a core command (bch) which locates sub-commands from system dirs, user dirs, and installed python packages (through the “blazech.commands” endpoint).

Features

  • locates plugin commands from various places

  • provides logging facilities

  • provides configuration file facilities (needs work)

The goal is to have an API that facilitates interaction between the environment, command line options, and configuration files ala pip.

Usage

Install BCH using easy_install or pip. Once installed, create a file for your first command:

# file location:
# *nix: ~/.blazech/command_hwp.py
# windows: %APPDATA%\.blazech\command_hwp.py

# file contents
from blazech.commands import BaseCommand

class Command(BaseCommand):
    name = 'hello-world'
    help = 'say hello'

    def create_arguments(self):
        #self.parser is the argparse parser for this sub-command
        self.parser.add_argument(
            '-n', '--name',
            help='who do you want to say hello to',
            default='world'
        )

    def execute(self, args):
        print 'hello %s' % args.name

to run:

# bch -h
usage: bch [-h] [-v] [-q] {hello-world} ...

positional arguments:
  {hello-world}
    hello-world     say hello
<...snip...>

$ bch hello-world
hello world

$ bch hello-world -n foo
hello foo

Questions & Comments

Please visit: http://groups.google.com/group/blazelibs

Current Status

Primary use cases work for me, but b/c of time constraints will probably move forward slowly.

The development version is installable with easy_install BlazeCommandHelper==dev.

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

BlazeCommandHelper-0.1.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

BlazeCommandHelper-0.1-py2.6.egg (19.8 kB view details)

Uploaded Source

File details

Details for the file BlazeCommandHelper-0.1.tar.gz.

File metadata

File hashes

Hashes for BlazeCommandHelper-0.1.tar.gz
Algorithm Hash digest
SHA256 1183ea2d853a566e9d6541e6fc74f9c739923c8148040c8f8a471ea3cfbdeb7f
MD5 e3542b7685b9be61cc2db6c9c2e97fc7
BLAKE2b-256 355b1cb8456726e0ca0bf7f3a3a879407e1b745c306be75eca64d616305485b4

See more details on using hashes here.

File details

Details for the file BlazeCommandHelper-0.1-py2.6.egg.

File metadata

File hashes

Hashes for BlazeCommandHelper-0.1-py2.6.egg
Algorithm Hash digest
SHA256 4434bd737193028497b10d68e97bc93978e3cd214f6fbdbf9be6451dd6439cea
MD5 1b1620c9cbabfdbb9372e43eab823b1c
BLAKE2b-256 80e6b82f2f025c71d1d82361fc07c6fabd2ee68cc8b43641b45d4a3a0346dcaa

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