cli: support dir and glob pattern on download #490
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Depends on #483
Needs
r-commons
release to pass - reanahub/reana-commons#253closes #402
To test
Pseudo-example
If it the pattern matches more than one file, you should get a zip downloaded, otherwise a single file.
TBD
When downloading a single file, until now, the path where this file is in the workspace is respected locally. This is because the file is saved directly using the value that is passed to the command as an argument. E.g.
reana-client download -w workflow foo/bar/myfile.txt
would create directoriesfoo/bar
for you as it uses this argument to save the file.After this PR, since the argument can be a glob pattern, we get the filename from the server-side and save it as it is, thus, causing the path where the file is not to be respected. This is done this way because otherwise, one might end up having folders called
\*\*
or similar. E.g.reana-client download -w workflow '**/myfile.txt'
would create a dir called\*\*
and putmyfile.txt
inside.Update 19/04/2021: It is possible to pass
attachment_filename
arg tosend_from_directory
so one can customize the content offilename
in theContent-Disposition
header. Passing there a relative path allows us to keep the folder structure and be backwards compatible. Updated on https://github.com/reanahub/reana-workflow-controller/pull/369/files