If action is tidy then don't bother hecking if TO_DIR is valid.

This commit is contained in:
Sean Hammond 2010-06-15 20:42:44 +01:00
parent df153565d4
commit 58ea1d15f3

View File

@ -179,24 +179,26 @@ if __name__ == "__main__":
print usage() print usage()
sys.exit(2) sys.exit(2)
try: if ACTION == 'tidy':
TO_DIR = sys.argv[3]
except IndexError:
TO_DIR = os.path.join('~','.dotfiles')
TO_DIR = os.path.abspath(os.path.expanduser(TO_DIR))
if not os.path.isdir(TO_DIR):
print "TO_DIR %s is not a directory!" % TO_DIR
print usage()
sys.exit(2)
if ACTION == 'link':
link(FROM_DIR,TO_DIR)
elif ACTION == 'tidy':
tidy(FROM_DIR) tidy(FROM_DIR)
elif ACTION == 'report':
link(FROM_DIR,TO_DIR,report=True)
tidy(FROM_DIR,report=True)
else: else:
print usage()
sys.exit(2) try:
TO_DIR = sys.argv[3]
except IndexError:
TO_DIR = os.path.join('~','.dotfiles')
TO_DIR = os.path.abspath(os.path.expanduser(TO_DIR))
if not os.path.isdir(TO_DIR):
print "TO_DIR %s is not a directory!" % TO_DIR
print usage()
sys.exit(2)
if ACTION == 'link':
link(FROM_DIR,TO_DIR)
elif ACTION == 'report':
link(FROM_DIR,TO_DIR,report=True)
tidy(FROM_DIR,report=True)
else:
print usage()
sys.exit(2)