Don't require TO_DIR argument if action is TIDY,

This commit is contained in:
Sean Hammond 2010-04-30 23:06:22 +01:00
parent 0e7156d022
commit bc6bd6c777

View File

@ -175,6 +175,10 @@ if __name__ == "__main__":
print "FROM_DIR %s is not a directory!" % FROM_DIR print "FROM_DIR %s is not a directory!" % FROM_DIR
print usage() print usage()
sys.exit(2) sys.exit(2)
FROM_DIR = os.path.abspath(os.path.expanduser(FROM_DIR))
if ACTION == 'tidy':
tidy(FROM_DIR)
else:
try: try:
TO_DIR = sys.argv[3] TO_DIR = sys.argv[3]
except IndexError: except IndexError:
@ -183,14 +187,9 @@ if __name__ == "__main__":
print "TO_DIR %s is not a directory!" % TO_DIR print "TO_DIR %s is not a directory!" % TO_DIR
print usage() print usage()
sys.exit(2) sys.exit(2)
TO_DIR = os.path.abspath(os.path.expanduser(TO_DIR)) TO_DIR = os.path.abspath(os.path.expanduser(TO_DIR))
FROM_DIR = os.path.abspath(os.path.expanduser(FROM_DIR))
if ACTION == 'link': if ACTION == 'link':
link(FROM_DIR,TO_DIR) link(FROM_DIR,TO_DIR)
elif ACTION == 'tidy':
tidy(FROM_DIR)
elif ACTION == 'report': elif ACTION == 'report':
link(FROM_DIR,TO_DIR,report=True) link(FROM_DIR,TO_DIR,report=True)
tidy(FROM_DIR,report=True) tidy(FROM_DIR,report=True)