#!/usr/bin/python
# -*- coding: utf-8 -*-

import os
import sys
import exceptions
import readline
import dealInput

def main():
    pass
    '''
    if len(sys.argv) < 3:
    message = sys.argv[1]
    message = sys.argv[2] ...
    '''
    cacheF = os.environ['HOME'] + "/.cdcache"
    cacheS = os.environ['HOME'] + "/.cdcacheselect"
    try:
        with open(cacheF, "r") as f :
            dI = dealInput.dealInput()
            cache = []
            for c in f.readlines():
                cache.append(c.rstrip())
            if len(cache) <= 0:
                print "empty cache"
            cdc = dI.selectListEle("cd cache", cache)
            if cdc != None:
		with open(cacheS, "w+") as fs :
		    fs.write("cd "+cdc)
            else:
                exit(2)
    except Exception as e:
        print e
        exit(1)


if __name__ == "__main__":
    main()
else:
    print __name__

