Re: -V, --version -- deprecated?

Lists: pgsql-hackers
From: Neil Conway <neilc(at)samurai(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: -V, --version -- deprecated?
Date: 2004-11-24 06:01:53
Message-ID: 1101276113.12045.26.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

The "--help" output for most of the binaries we install does not include
the "-V" option (just its alias, --version). Is this intentional?

(Note that we still document this option in the reference pages for some
commands, and initdb's help output does include "-V".)

Speaking of command-line options, "--version" and "--help" aren't
documented in a lot of command reference pages. Is there a good reason
why?

-Neil


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: -V, --version -- deprecated?
Date: 2004-11-24 10:29:47
Message-ID: 200411241129.47009.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Neil Conway wrote:
> The "--help" output for most of the binaries we install does not
> include the "-V" option (just its alias, --version). Is this
> intentional?
>
> (Note that we still document this option in the reference pages for
> some commands, and initdb's help output does include "-V".)

--help and --version are the standard options that are supported
everywhere. In the era before we had long options everywhere, we
implemented -V as an alternative in some programs, in particular those
in and around initdb, because of the version cross-checking it does
using those options.

At one point, long options where broken on some BSD versions. I don't
know what became of that, but if we don't have new information it might
be safest to leave things where they are.

Hence, the -V option is not the preferred public interface, so it's not
prominently documented, which may or may not be reasonable in minds
other than my own.

> Speaking of command-line options, "--version" and "--help" aren't
> documented in a lot of command reference pages. Is there a good
> reason why?

I am not aware of one.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


From: Neil Conway <neilc(at)samurai(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: -V, --version -- deprecated?
Date: 2004-11-24 13:02:10
Message-ID: 41A48652.3010506@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Peter Eisentraut wrote:
> --help and --version are the standard options that are supported
> everywhere. In the era before we had long options everywhere, we
> implemented -V as an alternative in some programs, in particular those
> in and around initdb, because of the version cross-checking it does
> using those options.

Ok, good to know. FWIW "-V" is almost universal among the client
binaries (not just those "in and around initdb").

> At one point, long options where broken on some BSD versions. I don't
> know what became of that, but if we don't have new information it might
> be safest to leave things where they are.

Can anyone confirm this? (If this actually affects any modern platforms
it means that "--help" doesn't work at the very least, which seems a Bad
Thing. So I'm a little skeptical that this is still a problem.)

> Hence, the -V option is not the preferred public interface, so it's not
> prominently documented, which may or may not be reasonable in minds
> other than my own.

Fair enough, but I think it's inconsistent to document it in some places
but not in others. I think we ought to either declare "-V" deprecated
(and perhaps remove the docs for it), or accept that we need to live
with it because of long-options silliness and document "-V" as a valid
alternate.

-Neil


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: -V, --version -- deprecated?
Date: 2004-11-25 01:25:58
Message-ID: 200411250125.iAP1PwX03871@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Neil Conway wrote:
> Peter Eisentraut wrote:
> > --help and --version are the standard options that are supported
> > everywhere. In the era before we had long options everywhere, we
> > implemented -V as an alternative in some programs, in particular those
> > in and around initdb, because of the version cross-checking it does
> > using those options.
>
> Ok, good to know. FWIW "-V" is almost universal among the client
> binaries (not just those "in and around initdb").
>
> > At one point, long options where broken on some BSD versions. I don't
> > know what became of that, but if we don't have new information it might
> > be safest to leave things where they are.
>
> Can anyone confirm this? (If this actually affects any modern platforms
> it means that "--help" doesn't work at the very least, which seems a Bad
> Thing. So I'm a little skeptical that this is still a problem.)

FreeBSD had a problem with double-dash args but I thought that related
to getopt, and I can't remember how that fits in. Maybe we defined '-'
in getopt and said it took an argument and tested for '-help' and
'-verbose', but now we just check argv right inside main. I can't
remember totally.

> > Hence, the -V option is not the preferred public interface, so it's not
> > prominently documented, which may or may not be reasonable in minds
> > other than my own.
>
> Fair enough, but I think it's inconsistent to document it in some places
> but not in others. I think we ought to either declare "-V" deprecated
> (and perhaps remove the docs for it), or accept that we need to live
> with it because of long-options silliness and document "-V" as a valid
> alternate.

Agreed. psql --help certainly looks inconsistent --- only --help and
--version are long.

---------------------------------------------------------------------------

Usage:
psql [OPTIONS]... [DBNAME [USERNAME]]

General options:
-d DBNAME specify database name to connect to (default:
"postgres")
-c COMMAND run only single command (SQL or internal) and exit
-f FILENAME execute commands from file, then exit
-l list available databases, then exit
-v NAME=VALUE set psql variable NAME to VALUE
-X do not read startup file (~/.psqlrc)
--help show this help, then exit
--version output version information, then exit

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Neil Conway <neilc(at)samurai(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: -V, --version -- deprecated?
Date: 2004-11-29 04:06:55
Message-ID: 1101701215.22124.27.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, 2004-11-24 at 20:25 -0500, Bruce Momjian wrote:
> FreeBSD had a problem with double-dash args but I thought that related
> to getopt, and I can't remember how that fits in. Maybe we defined '-'
> in getopt and said it took an argument and tested for '-help' and
> '-verbose', but now we just check argv right inside main. I can't
> remember totally.

ISTM that port/getopt_long.c ought to allow long options to work even if
the platform doesn't provide a getopt_long() itself.

BTW, pg_dump's "-X ..." options seem weird. Why is the "-X" prefix
necessary? ISTM pg_dump would be more consistent with standard
command-line tools if we just provided the long options (such as
--disable-triggers and so on) and did away with the "-X" prefixes.

I'd like to propose these changes:

(1) remove documentation for "-V", declare it deprecated. I don't see
any reason to actually remove it, but this should at least make the
current status quo more consistent.

(2) add documentation for "--help" and "--version" flags, where
appropriate

(3) remove documentation for pg_dump's "-X ..." flags, just document the
--long-option variant. Again, I don't see a need to remove support for
the -X options, but we should declare them deprecated.

Comments?

> Agreed. psql --help certainly looks inconsistent --- only --help and
> --version are long.

Well, perhaps, but I don't think that's a problem (there is no reason
that _every_ command-line flag needs to have both long and short
options).

-Neil