tests/test_cmd.py
author Dmitriy Morozov <dmitriy@mrzv.org>
Sat, 29 May 2010 15:46:31 -0700
changeset 105 1ce5c137b3e5
parent 96 82aaeccffbec
permissions -rw-r--r--
Added the ability to provide a completer for arguments to options

#!/usr/bin/env python

import opster

config_opts=[('c', 'config', 'webshops.ini', 'config file to use')]

@opster.command(config_opts)
def initdb(config):
    """Initialize database"""
    pass

@opster.command(config_opts)
def runserver(listen=('l', 'localhost', 'ip to listen on'),
              port=('p', 5000, 'port to listen on'),
              **opts):
    """Run development server"""
    print locals()

if __name__ == '__main__':
    opster.dispatch()