Skip to content

Commit

Permalink
Document that only the last value of --output is used, add test for it
Browse files Browse the repository at this point in the history
  • Loading branch information
samueloph committed Dec 8, 2024
1 parent 26d5e4c commit 77e9fc7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ should be using curl directly if your use case is not covered.

# Options


* `--curl-options, curl-options=<CURL_OPTIONS>`...

Specify extra options to be passed when invoking curl. May be specified more than once.
Expand All @@ -58,7 +57,8 @@ should be using curl directly if your use case is not covered.

Use the provided output path instead of getting it from the URL. If multiple
URLs are provided, all files will have the same name with a number appended to
the end (curl >= 7.83.0).
the end (curl >= 7.83.0). If this option is provided multiple times, only the
last value is considered.

* `--no-decode-filename`
Don't percent-decode the output filename, even if the percent-encoding in the
Expand Down
8 changes: 8 additions & 0 deletions tests/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ testOutputFileName()
assertContains "Verify whether 'wcurl' correctly sets a custom output filename" "${ret}" 'test filename'
}

testOutputFileNameRepeatedOption()
{
url='example.com'
ret=$(${WCURL_CMD} -o "test filename" -o "test filename2" ${url} 2>&1)
assertContains "Verify whether 'wcurl' correctly sets a custom output filename" "${ret}" '--output'
assertContains "Verify whether 'wcurl' correctly sets a custom output filename" "${ret}" 'test filename2'
}

testUrlDefaultName()
{
url='example%20with%20spaces.com'
Expand Down
3 changes: 2 additions & 1 deletion wcurl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ Options:
-o, -O, --output <PATH>: Use the provided output path instead of getting it from the URL. If
multiple URLs are provided, all files will have the same name with a
number appended to the end (curl >= 7.83.0).
number appended to the end (curl >= 7.83.0). If this option is provided
multiple times, only the last value is considered.
--no-decode-filename: Don't percent-decode the output filename, even if the percent-encoding in
the URL was done by wcurl, e.g.: The URL contained whitespaces.
Expand Down
3 changes: 2 additions & 1 deletion wcurl.1
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ Specify extra options to be passed when invoking curl. May be specified more tha
\fB\-o, \-O, \-\-output=\fI<PATH>\fR...\fR
Use the provided output path instead of getting it from the URL. If multiple
URLs are provided, all files will have the same name with a number appended to
the end (curl >= 7.83.0).
the end (curl >= 7.83.0). If this option is provided multiple times, only the
last value is considered.
.TP
\fB\-\-dry\-run\fR
Don't actually execute curl, just print what would be invoked.
Expand Down

0 comments on commit 77e9fc7

Please sign in to comment.