tests/test_opts.py
author Alexander Solovyov <alexander@solovyov.net>
Sun, 23 Jan 2011 22:39:37 +0100
changeset 170 daf0058366e2
parent 158 c3ab9c848675
permissions -rw-r--r--
Added tag 2.1 for changeset a083e23ed554

import pprint
from opster import command

@command(usage='[-l HOST] DIR')
def another(dirname,
            listen=('l', 'localhost', 'ip to listen on'),
            port=('p', 8000, 'port to listen on'),
            daemonize=('d', False, 'daemonize process'),
            pid_file=('', '', 'name of file to write process ID to'),
            definitions=('D', {}, 'just some definitions'),
            test=('t', lambda x: x or 'test', 'testing help for a function')):
    '''Command with option declaration as keyword arguments
    '''
    pprint.pprint(locals())

if __name__ == '__main__':
    another()