Skip to content

Conversation

samueloph
Copy link
Collaborator

I haven't thoroughly tested this and checked for corner cases yet, but does it make sense to document this usecase in the manpage?

Pending:

  • Check corner cases, e.g.: whitespaces, carriage return, breaklines, tabs...
  • Check non GNU/Linux portability.

@samueloph samueloph requested a review from sergiodj August 13, 2025 17:52
@bagder
Copy link
Member

bagder commented Aug 13, 2025

curl has native support from downloading a "URL list" with --url @file. I could be worth looking at what it would take for wcurl to offer that too.

@sergiodj
Copy link
Collaborator

I haven't thoroughly tested this and checked for corner cases yet, but does it make sense to document this usecase in the manpage?

I think this is more a shell script example than a wcurl example, TBH. The way wcurl is being invoked is exactly the same as you would do with a single URL, so there's nothing new for the user here (except how to make a loop in their shell, if they don't know yet).


```sh
while read -r url; do wcurl "$url"; done < filename.txt
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an extra space before the backticks, there should be two :)

@samueloph
Copy link
Collaborator Author

I'm still not yet sure whether it's a good idea to list this in the docs, it feels clunky due to the fact that this is just documenting how to write shellscript and not exactly a wcurl feature.

I wonder if it's really useful.

I'll keep this open while I make a decision.

@samueloph
Copy link
Collaborator Author

samueloph commented Sep 21, 2025

curl has native support from downloading a "URL list" with --url @file. I could be worth looking at what it would take for wcurl to offer that too.

Hmm, today, if one calls wcurl @input_file.txt, wcurl will set --output index.html, resulting in the first file of the list being named index.html, but still downloading everything.

But then even if we dropped --output when the URL starts with @ and let curl handle the list of URLs, we lose features like percent-decoding the URLs and their resulting filenames, plus the default filename of index.html for when curl can't infer one.

It's not great as this make wcurl behave differently whether the input is a file or URLs.

I don't think solving this without relying on curl's parsing of @file is too hard, but I want to approach a solution for this very carefully, considering whether it's really worth the extra code and what should be the UX (@file? -i/--input-file? both?).

I'll give it a go at a few ways to solve this and if I'll push a PR if I end up with anything that I'm happy with.

Edit - I've got it, will publish a PR soon.

samueloph added a commit that referenced this pull request Sep 22, 2025
 There are two ways of doing this now:
 1) wget way: -i, --input-file
 2) curl way: providing an URL argument starting with "@", wcurl will
    see "@filename" and download URLs from "filename".

 Lines starting with "#" inside input files are ignored.

 This is a continuation of #58
@samueloph
Copy link
Collaborator Author

I've published a PR with a proposal for how to achieve the input-file feature.

#66

samueloph added a commit that referenced this pull request Sep 23, 2025
 There are two ways of doing this now:
 1) wget way: -i, --input-file
 2) curl way: providing an URL argument starting with "@", wcurl will
    see "@filename" and download URLs from "filename".

 Lines starting with "#" inside input files are ignored.

 This is a continuation of #58

Co-authored-by: Sergio Durigan Junior <[email protected]>
samueloph added a commit that referenced this pull request Sep 23, 2025
 There are two ways of doing this now:
 1) wget way: -i, --input-file
 2) curl way: providing an URL argument starting with "@", wcurl will
    see "@filename" and download URLs from "filename".

 Lines starting with "#" inside input files are ignored.

 This is a continuation of #58

Co-authored-by: Sergio Durigan Junior <[email protected]>
samueloph added a commit that referenced this pull request Sep 24, 2025
 There are two ways of doing this now:
 1) wget way: -i, --input-file
 2) curl way: providing an URL argument starting with "@", wcurl will
    see "@filename" and download URLs from "filename".

 Lines starting with "#" inside input files are ignored.

 This is a continuation of #58

Co-authored-by: Sergio Durigan Junior <[email protected]>
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.

4 participants