test.py
author Alexander Solovyov <piranha@piranha.org.ua>
Fri, 26 Jun 2009 09:55:34 +0300
changeset 15 9477d21dc845
parent 14 4d1b80fd0e28
child 16 4c5c6e56c903
permissions -rwxr-xr-x
handle global --help option

#!/usr/bin/env python

import sys

from fancycmd import dispatch


def simple(ui, *args, **opts):
    '''Just simple command to do nothing.

    I assure you! Nothing to look here. ;-)
    '''
    print opts

def complex_(ui, *args, **opts):
    '''That's more complex command indented to do something

    Let's try to do that (damn, but what?!)
    '''
    print args, opts

cmdtable = {
    'simple':
        (simple,
         [('t', 'test', False, 'just test execution')],
         '[-t] ...'),
    'complex':
        (complex_,
         [],
         '')}

if __name__ == '__main__':
    dispatch(sys.argv[1:], cmdtable)