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 ec76c782c6).

This reverts commit bc6bd6c777.

Conflicts:

	dotfilemanager.py
This commit is contained in:
Sean Hammond 2010-05-01 00:51:12 +01:00
parent db4dab0953
commit 04172f4c40

View File

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