Per the discussion earlier re: sockets and psql




Synopsis: psql --help now returns:

[ snip ]

Connection options:
   -h [ HOSTNAME | DIR ]    specify database server host or location of
                            socket ($PGHOST, default: local socket)
   -p PORT                  specify database server port ($PGPORT, 
default: 5432)
   -U NAME                  specify database user name ($PGUSER, 
default: root)
   -W                       prompt for password (should happen 
automatically)

Nobody complained when I asked if it was too verbose, and I think it 
contributes to the helpfulness of the help. Additionally, the psql(1) 
page and the psql-ref.sgml document already explain this behaviour.

I spoke with Dennis Bjorklund about this on IRC, he suggested that this 
was easier for the translators, and is in the same style as pg_dump.c 
(why is there no src/bin/pg_dump/help.c?).

thanks,
alex

--
alex avriette, unix geek for hire
http://envy.posixnap.net/
alex@avriette.com
Sun, 11 May 2003 22:55:46 -0400
alex avriette <alex@posixnap.net>
patch src/bin/psql/help.c
alex avriette writes:

> Per the discussion earlier re: sockets and psql

It would be clearer if you list the environment variables in a separate
list below the options, not in the middle of the options without
explanation.  It seems, though, that if you list them in psql, you need to
list them everywhere they apply, and that might get a little verbose.

However, the name of the environment variable is PGUSER, not $PGUSER.

-- 
Peter Eisentraut   peter_e@gmx.net


Mon, 12 May 2003 19:37:07 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Re: patch src/bin/psql/help.c

>> Per the discussion earlier re: sockets and psql
>
> It would be clearer if you list the environment variables in a separate
> list below the options, not in the middle of the options without
> explanation.  It seems, though, that if you list them in psql, you 
> need to
> list them everywhere they apply, and that might get a little verbose.

Yeah. I would be happy to wander through and add a quick blurb about 
the environment variables to the rest of the bin/ tree. However, I 
think you're right, that it is a little too verbose. I couldn't come up 
with a better way to phrase it. I suppose it might be better to leave 
it out. My original aim was to make sure that the --help output 
included the use of a directory for -h.

Hm. Alternatively, something like mpg123's --longhelp comes to mind. 
Does anyone else see a need for something like that?

> However, the name of the environment variable is PGUSER, not $PGUSER.

Against my better judgment, I'll bite. 'Scuze me?

Alex


Mon, 12 May 2003 19:11:34 -0400
alex avriette <alex@posixnap.net>
Re: patch src/bin/psql/help.c
alex avriette writes:

> My original aim was to make sure that the --help output included the use
> of a directory for -h.

Hmm, what does that have to do with the environment variables?

To serve your end, I suppose you could go through the help outputs and
replace "database server host" by "database server host or socket
directory".

-- 
Peter Eisentraut   peter_e@gmx.net


Tue, 13 May 2003 11:27:09 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Re: patch src/bin/psql/help.c

> Hmm, what does that have to do with the environment variables?

Oh, well, after I read the man page, I realized that it explicitly 
states that PGHOST is either the socket directory or host. I figured 
specifying which options could be fed environment variables was useful. 
It was to me.

> To serve your end, I suppose you could go through the help outputs and
> replace "database server host" by "database server host or socket
> directory".

I think I'll do that.

Alex


Tue, 13 May 2003 18:22:50 -0400
alex avriette <alex@posixnap.net>
Re: patch src/bin/psql/help.c
Here is a patch to do the suggested renaming.

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

alex avriette wrote:
> 
> > Hmm, what does that have to do with the environment variables?
> 
> Oh, well, after I read the man page, I realized that it explicitly 
> states that PGHOST is either the socket directory or host. I figured 
> specifying which options could be fed environment variables was useful. 
> It was to me.
> 
> > To serve your end, I suppose you could go through the help outputs and
> > replace "database server host" by "database server host or socket
> > directory".
> 
> I think I'll do that.
> 
> Alex
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/docs/faqs/FAQ.html
> 

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

Index: src/bin/pg_dump/pg_dump.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_dump/pg_dump.c,v
retrieving revision 1.331
diff -c -c -r1.331 pg_dump.c
*** src/bin/pg_dump/pg_dump.c	30 May 2003 22:55:15 -0000	1.331
--- src/bin/pg_dump/pg_dump.c	2 Jun 2003 15:03:41 -0000
***************
*** 694,700 ****
  			 "                           disable triggers during data-only restore\n"));
  
  	printf(_("\nConnection options:\n"));
! 	printf(_("  -h, --host=HOSTNAME      database server host name\n"));
  	printf(_("  -p, --port=PORT          database server port number\n"));
  	printf(_("  -U, --username=NAME      connect as specified database user\n"));
  	printf(_("  -W, --password           force password prompt (should happen automatically)\n"));
--- 694,700 ----
  			 "                           disable triggers during data-only restore\n"));
  
  	printf(_("\nConnection options:\n"));
! 	printf(_("  -h, --host=HOSTNAME      database server host or socket directory\n"));
  	printf(_("  -p, --port=PORT          database server port number\n"));
  	printf(_("  -U, --username=NAME      connect as specified database user\n"));
  	printf(_("  -W, --password           force password prompt (should happen automatically)\n"));
Index: src/bin/pg_dump/pg_dumpall.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_dump/pg_dumpall.c,v
retrieving revision 1.20
diff -c -c -r1.20 pg_dumpall.c
*** src/bin/pg_dump/pg_dumpall.c	30 May 2003 23:55:10 -0000	1.20
--- src/bin/pg_dump/pg_dumpall.c	2 Jun 2003 15:03:42 -0000
***************
*** 253,259 ****
  	printf(_("  --version                output version information, then exit\n"));
  
  	printf(_("\nConnection options:\n"));
! 	printf(_("  -h, --host=HOSTNAME      database server host name\n"));
  	printf(_("  -p, --port=PORT          database server port number\n"));
  	printf(_("  -U, --username=NAME      connect as specified database user\n"));
  	printf(_("  -W, --password           force password prompt (should happen automatically)\n"));
--- 253,259 ----
  	printf(_("  --version                output version information, then exit\n"));
  
  	printf(_("\nConnection options:\n"));
! 	printf(_("  -h, --host=HOSTNAME      database server host or socket directory\n"));
  	printf(_("  -p, --port=PORT          database server port number\n"));
  	printf(_("  -U, --username=NAME      connect as specified database user\n"));
  	printf(_("  -W, --password           force password prompt (should happen automatically)\n"));
Index: src/bin/pg_dump/pg_restore.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_dump/pg_restore.c,v
retrieving revision 1.45
diff -c -c -r1.45 pg_restore.c
*** src/bin/pg_dump/pg_restore.c	4 Apr 2003 20:42:13 -0000	1.45
--- src/bin/pg_dump/pg_restore.c	2 Jun 2003 15:03:42 -0000
***************
*** 409,415 ****
  			 "                           disable triggers during data-only restore\n"));
  
  	printf(_("\nConnection options:\n"));
! 	printf(_("  -h, --host=HOSTNAME      database server host name\n"));
  	printf(_("  -p, --port=PORT          database server port number\n"));
  	printf(_("  -U, --username=NAME      connect as specified database user\n"));
  	printf(_("  -W, --password           force password prompt (should happen automatically)\n"));
--- 409,415 ----
  			 "                           disable triggers during data-only restore\n"));
  
  	printf(_("\nConnection options:\n"));
! 	printf(_("  -h, --host=HOSTNAME      database server host or socket directory\n"));
  	printf(_("  -p, --port=PORT          database server port number\n"));
  	printf(_("  -U, --username=NAME      connect as specified database user\n"));
  	printf(_("  -W, --password           force password prompt (should happen automatically)\n"));
Index: src/bin/psql/help.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/psql/help.c,v
retrieving revision 1.72
diff -c -c -r1.72 help.c
*** src/bin/psql/help.c	14 Apr 2003 16:23:36 -0000	1.72
--- src/bin/psql/help.c	2 Jun 2003 15:03:43 -0000
***************
*** 123,129 ****
  	puts(_("\nConnection options:"));
  	/* Display default host */
  	env = getenv("PGHOST");
! 	printf(_("  -h HOSTNAME     specify database server host (default: %s)\n"),
  		   env ? env : _("local socket"));
  	/* Display default port */
  	env = getenv("PGPORT");
--- 123,129 ----
  	puts(_("\nConnection options:"));
  	/* Display default host */
  	env = getenv("PGHOST");
! 	printf(_("  -h HOSTNAME     specify database server host or socket directory (default: %s)\n"),
  		   env ? env : _("local socket"));
  	/* Display default port */
  	env = getenv("PGPORT");
Index: src/bin/scripts/clusterdb
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/scripts/clusterdb,v
retrieving revision 1.11
diff -c -c -r1.11 clusterdb
*** src/bin/scripts/clusterdb	14 May 2003 03:26:03 -0000	1.11
--- src/bin/scripts/clusterdb	2 Jun 2003 15:03:43 -0000
***************
*** 123,129 ****
  	echo "  --help                    show this help, then exit"
  	echo
  	echo "Connection options:"
! 	echo "  -h, --host=HOSTNAME       database server host"
  	echo "  -p, --port=PORT           database server port"
  	echo "  -U, --username=USERNAME   user name to connect as"
  	echo "  -W, --password            prompt for password"
--- 123,129 ----
  	echo "  --help                    show this help, then exit"
  	echo
  	echo "Connection options:"
! 	echo "  -h, --host=HOSTNAME       database server host or socket directory"
  	echo "  -p, --port=PORT           database server port"
  	echo "  -U, --username=USERNAME   user name to connect as"
  	echo "  -W, --password            prompt for password"
Index: src/bin/scripts/createdb.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/scripts/createdb.c,v
retrieving revision 1.2
diff -c -c -r1.2 createdb.c
*** src/bin/scripts/createdb.c	14 May 2003 03:26:03 -0000	1.2
--- src/bin/scripts/createdb.c	2 Jun 2003 15:03:43 -0000
***************
*** 223,229 ****
  	printf(_("  --help                    show this help, then exit\n"));
  	printf(_("  --version                 output version information, then exit\n"));
  	printf(_("\nConnection options:\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host\n"));
  	printf(_("  -p, --port=PORT           database server port\n"));
  	printf(_("  -U, --username=USERNAME   user name to connect as\n"));
  	printf(_("  -W, --password            prompt for password\n"));
--- 223,229 ----
  	printf(_("  --help                    show this help, then exit\n"));
  	printf(_("  --version                 output version information, then exit\n"));
  	printf(_("\nConnection options:\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host or socket directory\n"));
  	printf(_("  -p, --port=PORT           database server port\n"));
  	printf(_("  -U, --username=USERNAME   user name to connect as\n"));
  	printf(_("  -W, --password            prompt for password\n"));
Index: src/bin/scripts/createlang.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/scripts/createlang.c,v
retrieving revision 1.2
diff -c -c -r1.2 createlang.c
*** src/bin/scripts/createlang.c	14 May 2003 03:26:03 -0000	1.2
--- src/bin/scripts/createlang.c	2 Jun 2003 15:03:43 -0000
***************
*** 276,282 ****
  	printf(_("  -e, --echo                show the commands being sent to the server\n"));
  	printf(_("  -l, --list                show a list of currently installed languages\n"));
  	printf(_("  -L, --pglib=DIRECTORY     find language interpreter file in DIRECTORY\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host\n"));
  	printf(_("  -p, --port=PORT           database server port\n"));
  	printf(_("  -U, --username=USERNAME   user name to connect as\n"));
  	printf(_("  -W, --password            prompt for password\n"));
--- 276,282 ----
  	printf(_("  -e, --echo                show the commands being sent to the server\n"));
  	printf(_("  -l, --list                show a list of currently installed languages\n"));
  	printf(_("  -L, --pglib=DIRECTORY     find language interpreter file in DIRECTORY\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host or socket directory\n"));
  	printf(_("  -p, --port=PORT           database server port\n"));
  	printf(_("  -U, --username=USERNAME   user name to connect as\n"));
  	printf(_("  -W, --password            prompt for password\n"));
Index: src/bin/scripts/createuser.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/scripts/createuser.c,v
retrieving revision 1.3
diff -c -c -r1.3 createuser.c
*** src/bin/scripts/createuser.c	27 May 2003 19:36:54 -0000	1.3
--- src/bin/scripts/createuser.c	2 Jun 2003 15:03:43 -0000
***************
*** 248,254 ****
  	printf(_("  --help                    show this help, then exit\n"));
  	printf(_("  --version                 output version information, then exit\n"));
  	printf(_("\nConnection options:\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host\n"));
  	printf(_("  -p, --port=PORT           database server port\n"));
  	printf(_("  -U, --username=USERNAME   user name to connect as (not the one to create)\n"));
  	printf(_("  -W, --password            prompt for password to connect\n"));
--- 248,254 ----
  	printf(_("  --help                    show this help, then exit\n"));
  	printf(_("  --version                 output version information, then exit\n"));
  	printf(_("\nConnection options:\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host or socket directory\n"));
  	printf(_("  -p, --port=PORT           database server port\n"));
  	printf(_("  -U, --username=USERNAME   user name to connect as (not the one to create)\n"));
  	printf(_("  -W, --password            prompt for password to connect\n"));
Index: src/bin/scripts/dropdb.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/scripts/dropdb.c,v
retrieving revision 1.3
diff -c -c -r1.3 dropdb.c
*** src/bin/scripts/dropdb.c	27 May 2003 19:36:54 -0000	1.3
--- src/bin/scripts/dropdb.c	2 Jun 2003 15:03:43 -0000
***************
*** 146,152 ****
  	printf(_("  -e, --echo                show the commands being sent to the server\n"));
  	printf(_("  -i, --interactive         prompt before deleting anything\n"));
  	printf(_("  -q, --quiet               don't write any messages\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host\n"));
  	printf(_("  -p, --port=PORT           database server port\n"));
  	printf(_("  -U, --username=USERNAME   user name to connect as\n"));
  	printf(_("  -W, --password            prompt for password\n"));
--- 146,152 ----
  	printf(_("  -e, --echo                show the commands being sent to the server\n"));
  	printf(_("  -i, --interactive         prompt before deleting anything\n"));
  	printf(_("  -q, --quiet               don't write any messages\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host or socket directory\n"));
  	printf(_("  -p, --port=PORT           database server port\n"));
  	printf(_("  -U, --username=USERNAME   user name to connect as\n"));
  	printf(_("  -W, --password            prompt for password\n"));
Index: src/bin/scripts/droplang.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/scripts/droplang.c,v
retrieving revision 1.2
diff -c -c -r1.2 droplang.c
*** src/bin/scripts/droplang.c	14 May 2003 03:26:03 -0000	1.2
--- src/bin/scripts/droplang.c	2 Jun 2003 15:03:43 -0000
***************
*** 244,250 ****
  	printf(_("  -d, --dbname=DBNAME       database to install language in\n"));
  	printf(_("  -e, --echo                show the commands being sent to the server\n"));
  	printf(_("  -l, --list                show a list of currently installed languages\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host\n"));
  	printf(_("  -p, --port=PORT           database server port\n"));
  	printf(_("  -U, --username=USERNAME   user name to connect as\n"));
  	printf(_("  -W, --password            prompt for password\n"));
--- 244,250 ----
  	printf(_("  -d, --dbname=DBNAME       database to install language in\n"));
  	printf(_("  -e, --echo                show the commands being sent to the server\n"));
  	printf(_("  -l, --list                show a list of currently installed languages\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host or socket directory\n"));
  	printf(_("  -p, --port=PORT           database server port\n"));
  	printf(_("  -U, --username=USERNAME   user name to connect as\n"));
  	printf(_("  -W, --password            prompt for password\n"));
Index: src/bin/scripts/dropuser.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/scripts/dropuser.c,v
retrieving revision 1.3
diff -c -c -r1.3 dropuser.c
*** src/bin/scripts/dropuser.c	27 May 2003 19:36:55 -0000	1.3
--- src/bin/scripts/dropuser.c	2 Jun 2003 15:03:43 -0000
***************
*** 143,152 ****
  	printf(_("Usage:\n"));
  	printf(_("  %s [OPTION]... [USERNAME]\n"), progname);
  	printf(_("\nOptions:\n"));
!     printf(_("  -e, --echo                show the commands being sent to the server\n"));
  	printf(_("  -i, --interactive         prompt before deleting anything\n"));
!     printf(_("  -q, --quiet               don't write any messages\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host\n"));
  	printf(_("  -p, --port=PORT           database server port\n"));
  	printf(_("  -U, --username=USERNAME   user name to connect as (not the one to drop)\n"));
  	printf(_("  -W, --password            prompt for password to connect\n"));
--- 143,152 ----
  	printf(_("Usage:\n"));
  	printf(_("  %s [OPTION]... [USERNAME]\n"), progname);
  	printf(_("\nOptions:\n"));
! 	printf(_("  -e, --echo                show the commands being sent to the server\n"));
  	printf(_("  -i, --interactive         prompt before deleting anything\n"));
! 	printf(_("  -q, --quiet               don't write any messages\n"));
! 	printf(_("  -h, --host=HOSTNAME       database server host or socket directory\n"));
  	printf(_("  -p, --port=PORT           database server port\n"));
  	printf(_("  -U, --username=USERNAME   user name to connect as (not the one to drop)\n"));
  	printf(_("  -W, --password            prompt for password to connect\n"));
Index: src/bin/scripts/vacuumdb
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/scripts/vacuumdb,v
retrieving revision 1.27
diff -c -c -r1.27 vacuumdb
*** src/bin/scripts/vacuumdb	14 May 2003 03:26:03 -0000	1.27
--- src/bin/scripts/vacuumdb	2 Jun 2003 15:03:43 -0000
***************
*** 140,146 ****
  	echo " --help                           show this help, then exit"
  	echo
  	echo "Connection options:"
! 	echo "  -h, --host=HOSTNAME             database server host"
  	echo "  -p, --port=PORT                 database server port"
  	echo "  -U, --username=USERNAME         user name to connect as"
  	echo "  -W, --password                  prompt for password"
--- 140,146 ----
  	echo " --help                           show this help, then exit"
  	echo
  	echo "Connection options:"
! 	echo "  -h, --host=HOSTNAME             database server host or socket directory"
  	echo "  -p, --port=PORT                 database server port"
  	echo "  -U, --username=USERNAME         user name to connect as"
  	echo "  -W, --password                  prompt for password"
Mon, 2 Jun 2003 11:23:14 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: [HACKERS] patch src/bin/psql/help.c