tool_urlglob: add named globs

Idea-by: Bastian Jesuiter

Verified by test 2408 - 2411

Closes #21409
This commit is contained in:
Daniel Stenberg 2026-04-22 11:38:02 +02:00
parent 2a2104f3cf
commit cb0636980b
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
13 changed files with 432 additions and 58 deletions

View file

@ -39,4 +39,17 @@ probably have to put the full URL within double quotes to avoid the shell from
interfering with it. This also goes for other characters treated special, like
for example '&', '?' and '*'.
The separate globbing components can be referenced in the --output option to
allow pieces to be reused in the target filename.
Starting in curl 8.21.0, the separate globbing parts can be named and
referenced by their names. The case sensitive alphanumeric name is set
enclosed within angle brackets after the opening character. Examples:
https://fun.example/{<number>one,two,three}.jpg
ftp://ftp.example.com/file[<range>1-100].txt
Setting the same glob name twice is an error.
Switch off globbing with --globoff.

View file

@ -69,3 +69,14 @@ override curl's internal binary output in terminal prevention:
Note that the binary output may be caused by the response being compressed, in
which case you may want to use the --compressed option.
Starting in curl 8.21.0, the separate globbing parts can be named and
referenced by their names. The case sensitive alphanumeric name is set
enclosed within angle brackets after the opening character. Examples:
curl "https://fun.example/{<num>one,two}.jpg" -o "save-#<num>"
curl "ftp://ftp.example/file[<range>1-100].txt" \
-o "save-#<range>.txt"
Referencing a named glob that is not set, causes an error.