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

View File

@ -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)