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

Document that only the last value of --output is used, add test for it #35

Merged
merged 1 commit into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a thought here: we now have to repeat these texts 3 times at least. It'd be great to have some kind of templating system.

Either way, I believe we can address this problem later, when we rewrite wcurl.

.TP
\fB\-\-dry\-run\fR
Don't actually execute curl, just print what would be invoked.
Expand Down
Loading