Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Clize: Command-line argument parsing for Python, without the effort
Python
Branch: master

Merge pull request #12 from karanparikh/hints

Added a suggestion when named options are mistyped.
latest commit 9ab8d2953c
@epsy authored
Failed to load latest commit information.
clize Merge branch 'hints'
docs
examples Doc proofreading.
.bzrignore Updated bzrignore
.coveragerc Improve test_runner's own coverage.
.gitignore
.travis.yml Fixed coveralls not receiving travis build info env
AUTHORS Added Karan Parikh to the AUTHORS
COPYING Offloaded the copyright holders to an AUTHORS file.
MANIFEST.in
README.rst Moved Gitter link to the top.
setup.cfg Refreshed setup.py
setup.py Version 3.0.
tox.ini Fixed coveralls not receiving travis build info env

README.rst

Clize

Join the chat at https://gitter.im/epsy/clize https://travis-ci.org/epsy/clize.svg?branch=master https://coveralls.io/repos/epsy/clize/badge.svg?branch=master

Clize procedurally turns your functions into convenient command-line interfaces.

For instance:

from sigtools.modifiers import kwoargs
from clize import run

@kwoargs('no_capitalize')
def hello_world(name=None, no_capitalize=False):
    """Greets the world or the given name.

    name: If specified, only greet this person.

    no_capitalize: Don't capitalize the given name.
    """
    if name:
        if not no_capitalize:
            name = name.title()
        return 'Hello {0}!'.format(name)
    return 'Hello world!'

if __name__ == '__main__':
    run(hello_world)

The python code above can now be used on the command-line as follows:

$ pip install clize
$ python hello.py --help
    Usage: hello.py [OPTIONS] name

    Greets the world or the given name.

    Positional arguments:
      name   If specified, only greet this person.

    Options:
      --no-capitalize   Don't capitalize the given name.

    Other actions:
      -h, --help   Show the help
$ python hello.py
Hello world!
$ python hello.py john
Hello John!
$ python hello.py dave --no-capitalize
Hello dave!

You can find the documentation at: http://clize.readthedocs.org/

Something went wrong with that request. Please try again.