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
1 changed files with 19 additions and 20 deletions

View File

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