Commit cfbb94f2 authored by DalmeGNU's avatar DalmeGNU

Update documentation about how to add a new command line option

* src/options.c: Update comments on how to add a new option
* docs/faq.md: Document how to add a new CLI-option
parent 74b3905b
Pipeline #29854394 passed with stage
in 17 minutes and 24 seconds
......@@ -6,6 +6,7 @@
* [How to do valgrind testing ?](#valgrind)
* [How to get a test coverage report ?](#coverage)
* [How to enable Control Flow Integrity (CFI) with clang ?](#cfi)
* [How to add a new command line option ?](#addOption)
# <a name="User Questions"/>User Questions
......@@ -73,3 +74,17 @@ To instrument clang's [CFI](https://clang.llvm.org/docs/ControlFlowIntegrity.htm
With clang-5.0 `-fsanitize=cfi-icall` does not work as expected.
Our logger callback functions are typed correctly, but falsely cause a hiccup.
## <a name="addOption"/>How to add a new command line option ?
Wget2 support many command line options, which are listed [here](wget2.md#Options). To add
a new one:
- Extend wget_options.h/struct config with the needed variable
- Add a default value for your variable in the 'config' initializer if needed (in options.c)
- Add the long option into 'options[]' (in options.c). keep alphabetical order !
- If appropriate, add a new parse function (see examples in options.c)
- Extend the documentation (at docs/wget2.md)
- Set args to -1 if value for an option is optional
You can find more information about the option handling in Wget2 at [our wiki](https://gitlab.com/gnuwget/wget2/wikis/Documentation/OptionHandling)
......@@ -30,13 +30,8 @@
* - add a default value for your variable in the 'config' initializer if needed (in this file)
* - add the long option into 'options[]' (in this file). keep alphabetical order !
* - if appropriate, add a new parse function (examples see below)
* - extend the print_help() function and the documentation
* - extend the documentation (at docs/wget2.md)
*
* First, I prepared the parsing to allow multiple arguments for an option,
* e.g. "--whatever arg1 arg2 ...".
* But now I think, it is ok to say 'each option may just have 0 or 1 option'.
* An option with a list of values might then look like: --whatever="arg1 arg2 arg3" or use
* any other argument separator. I remove the legacy code as soon as I am 100% sure...
* Set args to -1 if value for an option is optional.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment