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

Add --output/-o flag #28

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add --output/-o flag #28

wants to merge 1 commit into from

Conversation

WGH-
Copy link

@WGH- WGH- commented Nov 15, 2024

--remote-name-all is good default choice, but overriding the default inferred file name is still useful.

One could argue that one should use plain curl at this point, but wcurl still has lots of good defaults that are missing in plain curl binary and tedious to specify manually.

--curl-options=-owhatever is an option, but that's also very verbose.

Compare

sudo curl -fLOp /usr/local/sbin/wcurl https://raw.githubusercontent.com/curl/wcurl/main/wcurl

sudo wcurl --curl-options=-o/usr/local/sbin/wcurl https://raw.githubusercontent.com/curl/wcurl/main/wcurl

sudo wcurl -o /usr/local/sbin/wcurl https://raw.githubusercontent.com/curl/wcurl/main/wcurl

And the first one with plain curl still misses a lot of good wcurl defaults.

--remote-name-all is good default choice, but overriding the default
inferred file name is still useful.

One could argue that one should use plain curl at this point, but wcurl
still has lots of good defaults that are missing in plain curl binary
and tedious to specify manually.

--curl-options=-owhatever is an option, but that's also very verbose.

Compare

    sudo curl -fLOp /usr/local/sbin/wcurl https://raw.githubusercontent.com/curl/wcurl/main/wcurl

    sudo wcurl --curl-options=-o/usr/local/sbin/wcurl https://raw.githubusercontent.com/curl/wcurl/main/wcurl

    sudo wcurl -o /usr/local/sbin/wcurl https://raw.githubusercontent.com/curl/wcurl/main/wcurl

And the first one with plain curl still misses a lot of good wcurl
defaults.
@samueloph
Copy link
Member

Thank you for the PR.

So far we have relied on the fact the wcurl does not uses any parameter names from wget and curl (with the exception of -h, -V and --dry-run), the reason for this is to allow for more flexibility if/when wcurl becomes more complete, a possible future rewrite would allow us to not be stuck on old behaviors of parameters we choose when wcurl was still in POSIX shell.

This also allows a more complete wcurl to co-exist, not risking conflicting with limited parameters from POSIX shell wcurl, thus not having the same parameter name behaving differently between flavors of wcurl.

If a future wcurl decides to mimic all of the wget parameters, for example, then this becomes impossible if we add --output/-o (wget uses this for a logfile name).

I'm not saying this is a blocker, but merging this means we are making a decision that wcurl will not try to have the same parameters as wget in the future, it's a one-way door decision.

I would like to allow myself some time to think about this, and also to gather feedback from others.

And lastly, and less importantly, we need to decide how this should work when the user provides multiple URLs to be downloaded (wcurl will do it in parallel and use the same name for all). I believe that due to the usage --no-clobber, the files don't get overwritten, but this needs to be double-checked, and that's also likely not the behavior the user wants, unless we can make sure the filenames are ordered like the input URLs were (URL1 -> filename.1, URL2 -> filename2).

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

Successfully merging this pull request may close these issues.

2 participants