Hello Tom,

We've generally felt that deferring to the behavior of the platform's
getopt() or getopt_long() is a better idea than trying to enforce some
lowest-common-denominator version of switch parsing, on the theory that
users of a given platform will be used to whatever its getopt does.
This does mean that we have undocumented behaviors on particular
platforms.

Interesting.

I'd say that accepting "--" is one of them. Another example is that glibc's getopt is willing to reorder the arguments, so that for example this works for me:

$ psql template1 -E
psql (12devel)

Yep, I noticed that one by accident once.

On other platforms that would not work, so we don't document it.

People might get surprised anyway, because the very same command may or may not work depending on the platform. Does not matter much, though.

--
Fabien.


Reply via email to