From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de> |
Cc: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, "D(dot) S(dot)" <spider(at)skuggor(dot)se>, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: unrecognized option '--help |
Date: | 2015-05-22 01:59:56 |
Message-ID: | 20675.1432259996@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Andres Freund <andres(at)anarazel(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2015-05-22 02:08:42 | Re: unrecognized option '--help |
Previous Message | Alvaro Herrera | 2015-05-22 01:58:11 | Re: unrecognized option '--help |