def main():
    from sys import argv
    if len(argv) < 4:
        print "%s <Filter Name> <run|rerun|visualize> <osmdb_file> [<filter args> ...]" % argv[0]
        print "Filters:"
        for k,v in globals().items():
            if type(v) == type and issubclass(v,OSMDBFilter):
                print " -- %s" % k
        exit()
    
    filter_cls, mode, osmdb_file = argv[1:4]
    
    try:
        f = globals()[filter_cls]()
    except __HOLE__, e:
        raise Exception("Filter not found.")
    
    db = OSMDB(osmdb_file)
 
    if len(argv) > 4:
        extra = argv[4:]
    else:
        extra = []
    
    if mode == 'run':
        f.run(db, *extra)
    elif mode == 'rerun':
        f.rerun(db, *extra)
    elif mode == 'visualize':
        f.visualize(db, *extra)
    else:
        raise Exception("Unknown mode.")
dataset/ETHPy150Open bmander/graphserver/pygs/graphserver/ext/osm/osmfilters.py/main