Skip to content

Commit b802c8c

Browse files
author
Alireza Davoudian
committed
made repo list from function + revert deleted lines
1 parent fe9800d commit b802c8c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

daget/__main__.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def main():
2222
# get doi/url and resolve to landing page
2323
try:
2424
url = get_redirect_url(args.url)
25-
res = [ele for ele in ["dataverse.harvard.edu", "dataverse.no", "snd.se/catalogue", "snd.gu.se", "su.figshare.com", "figshare.scilifelab.se", "zenodo.org"] if(ele in url)]
26-
if res is False:
25+
26+
if get_file_list_from_repo(url) is None:
2727
raise RepoError(f'Landing page is not supported {url}')
2828
except ResolveError as err:
2929
print(bcolors.FAIL, f'Error resolving {args.url}: {err}', bcolors.ENDC)
@@ -38,6 +38,13 @@ def main():
3838
# get desitnation directory and create directory
3939
desitnation = os.path.realpath(args.destination)
4040

41+
if not os.path.exists(desitnation):
42+
os.makedirs(desitnation)
43+
else:
44+
if len(os.listdir(desitnation)) != 0:
45+
print(bcolors.FAIL, f'{desitnation} must be a empty directory or new directory path', bcolors.ENDC)
46+
exit(1)
47+
4148
print(f'destination: {desitnation}')
4249

4350
files = get_file_list_from_repo(url)

0 commit comments

Comments
 (0)