tool_getparam: add support for --longopt=value

If the long option name ends with an equals sign (`=`), the argument is
the text following on its right side.

This makes the command line parser accept this common style in addition
to the existing way to accept option arguments more similar to how other
command line tools do.

Example: `curl --user-agent=curl-2000 https://example.com/`

Change a few existing tests to use this syntax: 206, 1333, 1335, 1442
This commit is contained in:
Daniel Stenberg 2025-06-30 23:53:29 +02:00
parent c4430c542a
commit 520e9b4fd4
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
6 changed files with 30 additions and 6 deletions

View file

@ -24,6 +24,9 @@ When --next is used, it resets the parser state and you start again with a
clean option state, except for the options that are global. Global options
retain their values and meaning even after --next.
If the long option name ends with an equals sign (`=`), the argument is the
text following on its right side. (Added in 8.16.0)
The first argument that is exactly two dashes (`--`), marks the end of
options; any argument after the end of options is interpreted as a URL
argument even if it starts with a dash.