From 04172f4c409a748d0ed500595e663abdf0ff8d39 Mon Sep 17 00:00:00 2001 From: Sean Hammond Date: Sat, 1 May 2010 00:51:12 +0100 Subject: [PATCH] Revert "Don't require TO_DIR argument if action is TIDY," This change was not necessary (TO_DIR was never required), the wrong behaviour I was seeing was due to a different bug (which has been fixed by commit ec76c782c66799c5fd97). This reverts commit bc6bd6c777e6cc8499c29eee4576759615b5daf8. Conflicts: dotfilemanager.py --- dotfilemanager.py | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/dotfilemanager.py b/dotfilemanager.py index 4118b15..35cd8d1 100755 --- a/dotfilemanager.py +++ b/dotfilemanager.py @@ -167,32 +167,36 @@ if __name__ == "__main__": except IndexError: print usage() sys.exit(2) + try: FROM_DIR = sys.argv[2] except IndexError: FROM_DIR = '~' FROM_DIR = os.path.abspath(os.path.expanduser(FROM_DIR)) + if not os.path.isdir(FROM_DIR): print "FROM_DIR %s is not a directory!" % FROM_DIR print usage() sys.exit(2) - if ACTION == 'tidy': + + 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 == 'tidy': tidy(FROM_DIR) - else: - 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) + elif ACTION == 'report': + link(FROM_DIR,TO_DIR,report=True) + tidy(FROM_DIR,report=True) + else: + print usage() + sys.exit(2)