Andres Freund <andres@anarazel.de> writes:
> On 2015-05-21 21:44:36 -0400, Tom Lane wrote:
>> I think the only thing that would do what you wanted would be to
>> recognize *any* argv element matching "--help" as a help request.
>> Maybe that's all right, but I'm a tad worried about the possibility
>> of false positives. Are we so sure that that string could never be
>> a database name, table name, etc?
> I'm not following. Why does checking for --help/-? in the normal
> getopt_long call require that? In many, but not all, utilities only
> argv[1] is checked...
As I recall, Alvaro's argument for this was "I typed multiple words of a
command and then want to check syntax, so I add --help to the end of what
I'd already typed and hit return, with the idea of recalling the command
and deleting the --help off the end so I don't have to retype what I
already entered."
This use-case is only going to work reliably if --help is recognized
regardless of what's in front of it. Otherwise, if you're right in
suspecting that you got something wrong, getopt parsing will fail
before it gets to your --help --- and what it will print is "please
use --help", which is exactly the symptom being complained of here.
As I said, maybe that's okay. It'd certainly be 99.99% okay ... but
the other hundredth of a percent could be pretty painful.
regards, tom lane