*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit 86aa7a13 authored by Moser, Maximilian's avatar Moser, Maximilian
Browse files

Enhance logic for determining the files to `download()`

* if the `interactive` flag is set, actually query the user
* if it's just a single file anyway, just download that
parent 3ed2e68a
1 merge request!6v0.2.2
......@@ -117,12 +117,27 @@ def download(
# if we couldn't determine a file from the URL...
if fid is None:
if all:
avail_files = list(service.list_files(cid))
if len(avail_files) == 1:
fid = avail_files[0]
elif all:
# we either take all of them
fids = list(service.list_files(cid))
fids = avail_files
elif interactive:
# or we ask the user (TODO)
pass
# or we ask the user
selection = 0
for idx, file_ in enumerate(avail_files):
print(f"{idx+1}) {file_}")
while not (0 < selection <= len(avail_files)):
try:
selection = int(input(f"Select [1-{len(avail_files)}]: "))
except ValueError:
selection = 0
fid = avail_files[selection - 1]
else:
# or we give up
return None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment