This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

doing

Hierarchical command lines in python.

doing enables the simple creation of simple hierarchical command lines in Python programs.

It was originally designed to make it easy to create small Python tools that took the place of bash scripts in system maintenance, so the library assumes that packages and modules with names that do not start with an underscore are either commands or containers of sub-commands.

Contents

[TOC]

This is what you do

If the doing distribution is uncompressed to a directory, you’ll find a sample command-line program n the Python executable package called… sample.

This is the source code for sample/__main__.py:

#!/usr/bin/env python3
import doing
import sample

if __name__ == '__main__':
    doing.do_main(sample)

And this is what doing enables:

$ python -m sample
sample v1.0.0rc1 a sample hierarchical command line created with the doing package

    sample greet ...        greet in several languages
    sample version          display the version

Issuing a sub-command:

$ python -m sample version
version 1.0.0rc1

As sub-command with sub-sub-commands:

$ python -m sample greet
sample.greet  greet in several languages

    sample greet english    greet in English
    sample greet spanish    greet in Spanish

Finally:

$ python -m sample greet english
Hello!
$ python -m sample greet spanish
Hola!

Adding an executable script called do, with contents like those of __main__.py will let you do:

$ ./do greet english
Hello!
$ ./do greet spanish
Hola!

Implementing the doing command line

doing assumes that all packages and modules are potential commands or sub-commands. The description of the command is taken from the modules doc-comment (in mymodule.py or mypackage/__init__.py.

To enable doing for a top-level package, either provide a __main__.py or a do (or any other script name) as described in the introduction.

For modules and packages that execute some action, write a def do(): method in the module or in the packages __init__.py.

This is the contents of sample/greet/spanish.py:

"""
greet in Spanish
"""

def do():
    print('Hola!')

If doing finds that a command has modules implementing sub-commands, it will indicate so on the command help with an ellipsis:

sample greet ...        greet in several languages

end

Release History

Release History

1.0.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
doing-1.0.0-py2.py3-none-any.whl (7.0 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Sep 18, 2016
doing-1.0.0.tar.gz (5.7 kB) Copy SHA256 Checksum SHA256 Source Sep 18, 2016
doing-1.0.0.zip (11.6 kB) Copy SHA256 Checksum SHA256 Source Sep 18, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting