diff --git a/dotfilemanager.py b/dotfilemanager.py index b0ede0e..a5e817c 100755 --- a/dotfilemanager.py +++ b/dotfilemanager.py @@ -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)