Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

download --stdout option should also assume --no-directories #599

Open
hornc opened this issue Jul 13, 2023 · 1 comment
Open

download --stdout option should also assume --no-directories #599

hornc opened this issue Jul 13, 2023 · 1 comment
Labels

Comments

@hornc
Copy link
Contributor

hornc commented Jul 13, 2023

This is a suggestion / enhancement.

I don't think there is a valid usecase for the --stdout download option sending the downloaded files to STDOUT while creating empty directories? That is the behavior I am observing.

I am trying to download a lot of text files from many items and concatenate them to a single output file:

 while read identifier; do ia download $identifier ${identifier}_suffix.txt --stdout  ; done >> combined.txt < list-of-identifiers.tsv

Which does what I want, but creates a lot of empty directories.

I get the behavior I want by adding --no-directories to the command, but I think it's always safe to assume no directories with --stdout.

If this is deemed a good suggestion, I'd be prepared to implement it. I haven't looked at the code in a while, but I'm assuming it's pretty straightforward to pass another option.

@jjjake jjjake added the bug label Jul 24, 2023
@jjjake
Copy link
Owner

jjjake commented Jul 24, 2023

@hornc That sounds like a good suggestion to me. I think this is where we should make the change.

For example, this:

            if parent_dir != '' and return_responses is not True:
                os.makedirs(parent_dir, exist_ok=True)

Should be changed to something like:

            if parent_dir != '' and return_responses is not True and stdout is not True:
                os.makedirs(parent_dir, exist_ok=True)

Let me know if you have any questions, or if you'd like me to make the change. Thank!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants