test_opts.py
author Alexander Solovyov <piranha@piranha.org.ua>
Sat, 27 Jun 2009 22:17:18 +0300
changeset 22 8e56f2a8b90a
parent 21 b05cd4f91f53
child 23 3cd126244055
permissions -rwxr-xr-x
initial version of readme

#!/usr/bin/env python

import sys

from fancycmd import fancyopts

opts = [('l', 'listen', 'localhost', 'ip to listen on'),
        ('p', 'port', 8000, 'port to listen on'),
        ('d', 'daemonize', False, 'daemonize process'),
        ('', 'pid-file', '', 'name of file to write process ID to')]

def main(dirname, **opts):
    '''This is some command

    It looks very similar to some serve command
    '''
    print opts.get('pid_file')

if __name__ == '__main__':
    fancyopts(main, '%s [-l HOST] DIR' % sys.argv[0], opts, sys.argv[1:])