move main code to a function

master
neingeist 6 years ago
parent 8a2203ade7
commit 69f8a6470b

@ -37,6 +37,9 @@ def folder_id(folder_name):
return file1['id'] return file1['id']
def main():
global seen, drive
read_seen() read_seen()
gauth = GoogleAuth(settings_file=os.path.expanduser('~/.config/drive-download/settings.yaml')) gauth = GoogleAuth(settings_file=os.path.expanduser('~/.config/drive-download/settings.yaml'))
@ -51,7 +54,7 @@ file_names_dupes = [f for f, count in collections.Counter(file_names).items() if
if len(file_names_dupes) > 0: if len(file_names_dupes) > 0:
print('Duplicate filenames on Drive!') print('Duplicate filenames on Drive!')
for fn in sorted(file_names_dupes): for fn in sorted(file_names_dupes):
print(fn) print(shlex.quote(fn))
sys.exit(1) sys.exit(1)
for file1 in file_list: for file1 in file_list:
@ -70,4 +73,7 @@ for file1 in file_list:
print("{} exists locally!".format(shlex.quote(local_filename))) print("{} exists locally!".format(shlex.quote(local_filename)))
sys.exit(2) sys.exit(2)
main()
# vim:tw=100: # vim:tw=100:

Loading…
Cancel
Save