Move exception catch and return 1 back to main gitcheckup.

This commit is contained in:
voussoir 2020-01-28 01:42:37 -08:00
parent 88b3baafb8
commit 358ac9acbb

View file

@ -90,12 +90,8 @@ def checkup(directory, do_fetch=False):
def read_directories_file(): def read_directories_file():
directories_file = os.path.join(os.path.dirname(__file__), 'gitcheckup.txt') directories_file = os.path.join(os.path.dirname(__file__), 'gitcheckup.txt')
try:
handle = open(directories_file, 'r')
except FileNotFoundError:
print(f'Please put your git repo locations in {directories_file}.')
return 1
handle = open(directories_file, 'r')
directories = handle.readlines() directories = handle.readlines()
handle.close() handle.close()
@ -105,7 +101,11 @@ def read_directories_file():
return directories return directories
def gitcheckup(do_fetch=False): def gitcheckup(do_fetch=False):
directories = read_directories_file() try:
directories = read_directories_file()
except FileNotFoundError as exc:
print(f'Please put your git repo locations in {exc.filename}.')
return 1
for directory in directories: for directory in directories:
result = checkup(directory, do_fetch=do_fetch) result = checkup(directory, do_fetch=do_fetch)