On 24/10/19 10:38 am, Ethan Sommer wrote:
> Adds a "?" suffix that can be used to indicate that an option's argument is
> optional.
> 
> This allows options to have a default behaviour when the user doesn't
> specify one, e.g.: --color=[when] being able to behave like --color=auto
> when only --color is passed
> 
> Options with optional arguments given on the command line will be returned
> in the form "--opt=optarg" and "-o=optarg". Despite that not being the
> syntax for passing an argument with a shortopt (trying to pass -o=foo
> would make -o's argument "=foo"), this is done to allow the caller to split
> the option and its optarg easily
> 

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?

Why not follow the GNU extension to getopt and use '::' for option
arguments instead of '?'

Allan

Reply via email to