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