[pacman-dev] [PATCH v3] libmakepkg: add optional argument support to parseopts

Ethan Sommer e5ten.arch at gmail.com
Sun Nov 3 20:41:11 UTC 2019


> Again...  devils advocate.  You give an example of '--colour=auto' being
> equivalent to '--color'.  Why would the default when the options is not
> specified not be default in the codebase?
Fair enough, another example could be if you wanted to allow specifying
a custom log file for whatever reason, one could make -L/--log have an
optional argument to specify what file to output the log to, and if no
argument is given use the default log file that makepkg currently
chooses.
> Why not follow the GNU extension to getopt and use '::' for option
> arguments instead of '?'
The existing code is built around checking for and removing one trailing
character from an option, it'd require both more code change and more
code all-around to deal with checking for the same character either once
or twice than to just check for a different single trailing character.


More information about the pacman-dev mailing list